containerized-data-importer/tests/explain_test.go
Maya Rashish 81deac9fcf
Split up utils.go to logical divisions (#2310)
* Remove unused function PanicOnError

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Remove logic for skipping a test on old kubectl

1.14.0 is pretty old, assume a new enough kubectl is used now.
Simplify utils.go which has an elaborate function for detecting
the version used.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Make functions private if they're only used in one file

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Move prometheus functions to tests/framework/prometheus.go

Split utils.go into meaningful filenames.
Framework was chosen because it uses framework things, and that
can't be done from utils without circular imports.

Make functions part of the framework struct wherever possible
to avoid needing to pass extra arguments.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Move {Create,Run}KubectlCommand to framework

Allows moving more things away from tests/utils.go towards the goal
of eliminating it.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Move CreateVddkWarmImportDataVolume into own file in framework

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Move node placement utils to a separate file in framework package

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Move WaitForConditions and associated functions to util

Pass it a ClientsIface instead of pulling in framework.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Move pod log functions to framework/pod.go, delete tests/utils.go

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Fix typo

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Use CombinedOutput - shows stderr in the output unconditionally

Simplifies the code.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2022-07-04 10:48:40 +02:00

42 lines
1.6 KiB
Go

package tests_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"kubevirt.io/containerized-data-importer/tests/framework"
)
var _ = Describe("Explain tests", func() {
f := framework.NewFramework("explain-test", framework.Config{
SkipNamespaceCreation: true,
})
It("[test_id:4964]explain should have descriptions for CDI", func() {
out, err := f.RunKubectlCommand("explain", "CDI")
Expect(err).ToNot(HaveOccurred())
Expect(out).To(ContainSubstring("CDIStatus defines the status of the installation"))
out, err = f.RunKubectlCommand("explain", "CDI.status")
Expect(err).ToNot(HaveOccurred())
Expect(out).To(ContainSubstring("The desired version of the resource"))
})
It("[test_id:4965]explain should have descriptions for CDIConfig", func() {
out, err := f.RunKubectlCommand("explain", "CDIConfig")
Expect(err).ToNot(HaveOccurred())
Expect(out).To(ContainSubstring("CDIConfigStatus provides the most recently observed status of the CDI"))
out, err = f.RunKubectlCommand("explain", "CDIConfig.status")
Expect(err).ToNot(HaveOccurred())
Expect(out).To(ContainSubstring("The calculated upload proxy URL"))
})
It("[test_id:4966]explain should have descriptions for Datavolume", func() {
out, err := f.RunKubectlCommand("explain", "dv")
Expect(err).ToNot(HaveOccurred())
Expect(out).To(ContainSubstring("DataVolumeStatus contains the current status of the DataVolume"))
out, err = f.RunKubectlCommand("explain", "dv.status")
Expect(err).ToNot(HaveOccurred())
Expect(out).To(ContainSubstring("RestartCount is the number of times the pod populating the DataVolume has"))
})
})