Skip to content

Commit

Permalink
lint: Fix 'dot-imports' revive warnings
Browse files Browse the repository at this point in the history
This addresses a whole bunch of warnings such as:

test/integration/utilities_test.go:12:2: dot-imports: should not use dot imports (revive)
	. "github.com/onsi/gomega"
	^
test/integration/podman_test.go:10:2: dot-imports: should not use dot imports (revive)
	. "github.com/onsi/ginkgo/v2"
	^
test/integration/podman_test.go:11:2: dot-imports: should not use dot imports (revive)
	. "github.com/onsi/gomega"
	^

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
  • Loading branch information
cfergeau committed Jan 31, 2024
1 parent f65ec54 commit 21025ab
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 144 deletions.
50 changes: 25 additions & 25 deletions test/integration/podman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,39 @@ import (

"github.com/crc-org/crc/v2/test/extended/crc/cmd"
"github.com/crc-org/crc/v2/test/extended/util"
. "github.com/onsi/ginkgo/v2" //revive:disable-line:dot-imports
. "github.com/onsi/gomega" //revive:disable-line:dot-imports
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)

var _ = Describe("podman preset", Serial, Ordered, Label("podman-preset"), func() {
var _ = ginkgo.Describe("podman preset", ginkgo.Serial, ginkgo.Ordered, ginkgo.Label("podman-preset"), func() {

// runs 1x after all the It blocks (specs) inside this Describe node
AfterAll(func() {
ginkgo.AfterAll(func() {

// cleanup CRC
Expect(RunCRCExpectSuccess("cleanup")).To(MatchRegexp("Cleanup finished"))
gomega.Expect(RunCRCExpectSuccess("cleanup")).To(gomega.MatchRegexp("Cleanup finished"))

// remove config file crc.json
err := util.RemoveCRCConfig()
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())

})

Describe("basic use", Serial, Ordered, func() {
ginkgo.Describe("basic use", ginkgo.Serial, ginkgo.Ordered, func() {

It("write to config", func() {
Expect(RunCRCExpectSuccess("config", "set", "preset", "podman")).To(ContainSubstring("please run 'crc setup' before 'crc start'"))
ginkgo.It("write to config", func() {
gomega.Expect(RunCRCExpectSuccess("config", "set", "preset", "podman")).To(gomega.ContainSubstring("please run 'crc setup' before 'crc start'"))
})

It("setup CRC", func() {
Expect(RunCRCExpectSuccess("setup")).To(ContainSubstring("Your system is correctly setup for using CRC"))
ginkgo.It("setup CRC", func() {
gomega.Expect(RunCRCExpectSuccess("setup")).To(gomega.ContainSubstring("Your system is correctly setup for using CRC"))
})

It("start CRC", func() {
Expect(RunCRCExpectSuccess("start")).To(ContainSubstring("podman runtime is now running"))
ginkgo.It("start CRC", func() {
gomega.Expect(RunCRCExpectSuccess("start")).To(gomega.ContainSubstring("podman runtime is now running"))
})

It("podman-env", func() {
ginkgo.It("podman-env", func() {
// Do what 'eval $(crc podman-env) would do
path := os.ExpandEnv("${HOME}/.crc/bin/oc:$PATH")
csshk := os.ExpandEnv("${HOME}/.crc/machines/crc/id_ecdsa")
Expand All @@ -62,28 +62,28 @@ var _ = Describe("podman preset", Serial, Ordered, Label("podman-preset"), func(
os.Setenv("DOCKER_HOST", dh)
})

It("version", func() {
ginkgo.It("version", func() {
out, err := cmd.RunPodmanExpectSuccess("version")
Expect(err).NotTo(HaveOccurred())
Expect(out).Should(MatchRegexp(`Version:[\s]*\d+\.\d+\.\d+`))
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(out).Should(gomega.MatchRegexp(`Version:[\s]*\d+\.\d+\.\d+`))
})

It("pull image", func() {
ginkgo.It("pull image", func() {
_, err := cmd.RunPodmanExpectSuccess("pull", "fedora")
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())
})

It("run image", func() {
ginkgo.It("run image", func() {
_, err := cmd.RunPodmanExpectSuccess("run", "fedora")
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())
})

It("cleanup CRC", func() {
Expect(RunCRCExpectSuccess("cleanup")).To(MatchRegexp("Cleanup finished"))
ginkgo.It("cleanup CRC", func() {
gomega.Expect(RunCRCExpectSuccess("cleanup")).To(gomega.MatchRegexp("Cleanup finished"))
})

It("unset preset in config", func() {
Expect(RunCRCExpectSuccess("config", "unset", "preset")).To(ContainSubstring("Successfully unset configuration property 'preset'"))
ginkgo.It("unset preset in config", func() {
gomega.Expect(RunCRCExpectSuccess("config", "unset", "preset")).To(gomega.ContainSubstring("Successfully unset configuration property 'preset'"))
})
})
})
66 changes: 33 additions & 33 deletions test/integration/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@ import (

crcCmd "github.com/crc-org/crc/v2/test/extended/crc/cmd"
"github.com/crc-org/crc/v2/test/extended/util"
. "github.com/onsi/ginkgo/v2" //revive:disable-line:dot-imports
. "github.com/onsi/gomega" //revive:disable-line:dot-imports
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)

var _ = Describe("", Serial, Ordered, Label("openshift-preset", "goproxy"), func() {
var _ = ginkgo.Describe("", ginkgo.Serial, ginkgo.Ordered, ginkgo.Label("openshift-preset", "goproxy"), func() {

// runs 1x after all the It blocks (specs) inside this Describe node
AfterAll(func() {
ginkgo.AfterAll(func() {

// cleanup CRC
Expect(RunCRCExpectSuccess("cleanup")).To(MatchRegexp("Cleanup finished"))
gomega.Expect(RunCRCExpectSuccess("cleanup")).To(gomega.MatchRegexp("Cleanup finished"))

// remove config file crc.json
err := util.RemoveCRCConfig()
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())

// HTTP_PROXY and HTTPS_PROXY vars were set implicitly
// unset them at the end
err = os.Unsetenv("HTTPS_PROXY")
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())

err = os.Unsetenv("HTTP_PROXY")
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())

})

go util.RunProxy()

Describe("Behind proxy", Serial, Ordered, func() {
ginkgo.Describe("Behind proxy", ginkgo.Serial, ginkgo.Ordered, func() {

httpProxy := "http://127.0.0.1:8888"
httpsProxy := "http://127.0.0.1:8888"
Expand All @@ -48,63 +48,63 @@ var _ = Describe("", Serial, Ordered, Label("openshift-preset", "goproxy"), func

// Start goproxy

It("configure CRC", func() {
Expect(RunCRCExpectSuccess("config", "set", "http-proxy", httpProxy)).To(ContainSubstring("Successfully configured http-proxy"))
Expect(RunCRCExpectSuccess("config", "set", "https-proxy", httpsProxy)).To(ContainSubstring("Successfully configured https-proxy"))
Expect(RunCRCExpectSuccess("config", "set", "no-proxy", noProxy)).To(ContainSubstring("Successfully configured no-proxy"))
Expect(RunCRCExpectSuccess("config", "set", "proxy-ca-file", util.CACertTempLocation)).To(ContainSubstring("Successfully configured proxy-ca-file"))
ginkgo.It("configure CRC", func() {
gomega.Expect(RunCRCExpectSuccess("config", "set", "http-proxy", httpProxy)).To(gomega.ContainSubstring("Successfully configured http-proxy"))
gomega.Expect(RunCRCExpectSuccess("config", "set", "https-proxy", httpsProxy)).To(gomega.ContainSubstring("Successfully configured https-proxy"))
gomega.Expect(RunCRCExpectSuccess("config", "set", "no-proxy", noProxy)).To(gomega.ContainSubstring("Successfully configured no-proxy"))
gomega.Expect(RunCRCExpectSuccess("config", "set", "proxy-ca-file", util.CACertTempLocation)).To(gomega.ContainSubstring("Successfully configured proxy-ca-file"))
if runtime.GOOS != "linux" {
Expect(RunCRCExpectSuccess("config", "set", "host-network-access", "true")).To(ContainSubstring("Changes to configuration property 'host-network-access' are only applied during 'crc setup'"))
gomega.Expect(RunCRCExpectSuccess("config", "set", "host-network-access", "true")).To(gomega.ContainSubstring("Changes to configuration property 'host-network-access' are only applied during 'crc setup'"))
}
})

It("setup CRC", func() {
ginkgo.It("setup CRC", func() {
if bundlePath == "" {
Expect(RunCRCExpectSuccess("setup")).To(ContainSubstring("Your system is correctly setup for using CRC"))
gomega.Expect(RunCRCExpectSuccess("setup")).To(gomega.ContainSubstring("Your system is correctly setup for using CRC"))
} else {
Expect(RunCRCExpectSuccess("setup", "-b", bundlePath)).To(ContainSubstring("Your system is correctly setup for using CRC"))
gomega.Expect(RunCRCExpectSuccess("setup", "-b", bundlePath)).To(gomega.ContainSubstring("Your system is correctly setup for using CRC"))
}
})

It("start CRC", func() {
ginkgo.It("start CRC", func() {
// default values: "--memory", "9216", "--cpus", "4", "disk-size", "31"
if bundlePath == "" {
Expect(RunCRCExpectSuccess("start", "-p", pullSecretPath)).To(ContainSubstring("Started the OpenShift cluster"))
gomega.Expect(RunCRCExpectSuccess("start", "-p", pullSecretPath)).To(gomega.ContainSubstring("Started the OpenShift cluster"))
} else {
Expect(RunCRCExpectSuccess("start", "-b", bundlePath, "-p", pullSecretPath)).To(ContainSubstring("Started the OpenShift cluster"))
gomega.Expect(RunCRCExpectSuccess("start", "-b", bundlePath, "-p", pullSecretPath)).To(gomega.ContainSubstring("Started the OpenShift cluster"))
}
})

It("wait for cluster in Running state", func() {
ginkgo.It("wait for cluster in Running state", func() {
err := crcCmd.WaitForClusterInState("running")
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())
})

It("login to cluster using crc-admin context", func() {
ginkgo.It("login to cluster using crc-admin context", func() {

err := util.AddOCToPath()
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())

cmd := exec.Command("oc", "config", "use-context", "crc-admin")
err = cmd.Run()
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())

cmd = exec.Command("oc", "whoami")
out, err := cmd.Output()
Expect(err).NotTo(HaveOccurred())
Expect(string(out)).To(ContainSubstring("kubeadmin"))
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(string(out)).To(gomega.ContainSubstring("kubeadmin"))

cmd = exec.Command("oc", "get", "co")
err = cmd.Run()
Expect(err).NotTo(HaveOccurred())
gomega.Expect(err).NotTo(gomega.HaveOccurred())
})

It("stop CRC", func() {
Expect(RunCRCExpectSuccess("stop", "-f")).To(MatchRegexp("[Ss]topped the instance"))
ginkgo.It("stop CRC", func() {
gomega.Expect(RunCRCExpectSuccess("stop", "-f")).To(gomega.MatchRegexp("[Ss]topped the instance"))
})

It("cleanup CRC", func() {
Expect(RunCRCExpectSuccess("cleanup")).To(MatchRegexp("Cleanup finished"))
ginkgo.It("cleanup CRC", func() {
gomega.Expect(RunCRCExpectSuccess("cleanup")).To(gomega.MatchRegexp("Cleanup finished"))
})

})
Expand Down
Loading

0 comments on commit 21025ab

Please sign in to comment.