-
Notifications
You must be signed in to change notification settings - Fork 13
/
containers_image_tag.go
75 lines (61 loc) · 2.78 KB
/
containers_image_tag.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package tests
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/test-network-function/cnfcert-tests-verification/tests/globalhelper"
"github.com/test-network-function/cnfcert-tests-verification/tests/globalparameters"
tsparams "github.com/test-network-function/cnfcert-tests-verification/tests/manageability/parameters"
"github.com/test-network-function/cnfcert-tests-verification/tests/utils/pod"
)
var _ = Describe("manageability-containers-image-tag", func() {
var randomNamespace string
var randomReportDir string
var randomTnfConfigDir string
BeforeEach(func() {
// Create random namespace and keep original report and TNF config directories
randomNamespace, randomReportDir, randomTnfConfigDir =
globalhelper.BeforeEachSetupWithRandomNamespace(tsparams.ManageabilityNamespace)
By("Define TNF config file")
err := globalhelper.DefineTnfConfig(
[]string{randomNamespace},
[]string{tsparams.TestPodLabel},
[]string{},
[]string{},
[]string{}, randomTnfConfigDir)
Expect(err).ToNot(HaveOccurred())
})
AfterEach(func() {
globalhelper.AfterEachCleanupWithRandomNamespace(randomNamespace, randomReportDir, randomTnfConfigDir, tsparams.WaitingTime)
})
It("One pod with valid image tag", func() {
By("Define pod")
testPod := pod.DefinePod(tsparams.TestPodName, randomNamespace,
tsparams.TestImageWithValidTag, tsparams.TnfTargetPodLabels)
By("Create pod")
err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
Expect(err).ToNot(HaveOccurred())
By("Start containers-image-tag test")
err = globalhelper.LaunchTests(tsparams.TnfContainerImageTag,
globalhelper.ConvertSpecNameToFileName(CurrentSpecReport().FullText()), randomReportDir, randomTnfConfigDir)
Expect(err).ToNot(HaveOccurred())
By("Verify test case status in Claim report")
err = globalhelper.ValidateIfReportsAreValid(tsparams.TnfContainerImageTag,
globalparameters.TestCasePassed, randomReportDir)
Expect(err).ToNot(HaveOccurred())
})
It("One pod with invalid image tag", func() {
By("Define pod")
testPod := pod.DefinePod(tsparams.TestPodName, randomNamespace,
globalhelper.GetConfiguration().General.TestImage, tsparams.TnfTargetPodLabels)
err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
Expect(err).ToNot(HaveOccurred())
By("Start containers-image-tag test")
err = globalhelper.LaunchTests(tsparams.TnfContainerImageTag,
globalhelper.ConvertSpecNameToFileName(CurrentSpecReport().FullText()), randomReportDir, randomTnfConfigDir)
Expect(err).ToNot(HaveOccurred())
By("Verify test case status in Claim report")
err = globalhelper.ValidateIfReportsAreValid(tsparams.TnfContainerImageTag,
globalparameters.TestCaseFailed, randomReportDir)
Expect(err).ToNot(HaveOccurred())
})
})