@@ -32,7 +32,6 @@ import (
32
32
"github.com/onsi/ginkgo"
33
33
ginkgoconfig "github.com/onsi/ginkgo/config"
34
34
"github.com/onsi/gomega"
35
- log "github.com/sirupsen/logrus"
36
35
"github.com/test-network-function/test-network-function/pkg/tnf"
37
36
"github.com/test-network-function/test-network-function/pkg/tnf/handlers/base/redhat"
38
37
"github.com/test-network-function/test-network-function/pkg/tnf/handlers/cnffsdiff"
@@ -116,23 +115,25 @@ func testContainerIsRedHatRelease(cut *config.Container) {
116
115
func testContainersFsDiff (env * config.TestEnvironment ) {
117
116
testID := identifiers .XformToGinkgoItIdentifier (identifiers .TestUnalteredBaseImageIdentifier )
118
117
ginkgo .It (testID , func () {
119
- fsDiffContainer := env .FsDiffMasterContainer
120
- if fsDiffContainer != nil {
121
- for _ , cut := range env .ContainersUnderTest {
122
- podName := cut .Oc .GetPodName ()
123
- containerName := cut .Oc .GetPodContainerName ()
124
- context := cut .Oc
125
- ginkgo .By (fmt .Sprintf ("%s(%s) should not install new packages after starting" , podName , containerName ))
126
- testContainerFsDiff (fsDiffContainer .Oc , context )
118
+ var badContainers []string
119
+ for _ , cut := range env .ContainersUnderTest {
120
+ podName := cut .Oc .GetPodName ()
121
+ containerName := cut .Oc .GetPodContainerName ()
122
+ context := cut .Oc
123
+ nodeName := cut .ContainerConfiguration .NodeName
124
+ ginkgo .By (fmt .Sprintf ("%s(%s) should not install new packages after starting" , podName , containerName ))
125
+ testResult , err := testContainerFsDiff (nodeName , context )
126
+ if testResult != tnf .SUCCESS || err != nil {
127
+ badContainers = append (badContainers , containerName )
128
+ ginkgo .By (fmt .Sprintf ("pod %s container %s did update/install/modify additional packages" , podName , containerName ))
127
129
}
128
- } else {
129
- log .Warn ("no fs diff container is configured, cannot run fs diff test" )
130
130
}
131
+ gomega .Expect (badContainers ).To (gomega .BeNil ())
131
132
})
132
133
}
133
134
134
135
// testContainerFsDiff test that the CUT didn't install new packages after starting, and report through Ginkgo.
135
- func testContainerFsDiff (masterPodOc , targetContainerOC * interactive.Oc ) {
136
+ func testContainerFsDiff (nodeName string , targetContainerOC * interactive.Oc ) ( int , error ) {
136
137
defer results .RecordResult (identifiers .TestUnalteredBaseImageIdentifier )
137
138
targetContainerOC .GetExpecter ()
138
139
containerIDTester := containerid .NewContainerID (common .DefaultTimeout )
@@ -142,13 +143,11 @@ func testContainerFsDiff(masterPodOc, targetContainerOC *interactive.Oc) {
142
143
gomega .Expect (testResult ).To (gomega .Equal (tnf .SUCCESS ))
143
144
gomega .Expect (err ).To (gomega .BeNil ())
144
145
containerID := containerIDTester .GetID ()
145
-
146
- fsDiffTester := cnffsdiff .NewFsDiff (common .DefaultTimeout , containerID )
147
- test , err = tnf .NewTest (masterPodOc .GetExpecter (), fsDiffTester , []reel.Handler {fsDiffTester }, masterPodOc .GetErrorChannel ())
148
- gomega .Expect (err ).To (gomega .BeNil ())
149
- testResult , err = test .Run ()
150
- gomega .Expect (testResult ).To (gomega .Equal (tnf .SUCCESS ))
146
+ context := common .GetContext ()
147
+ fsDiffTester := cnffsdiff .NewFsDiff (common .DefaultTimeout , containerID , nodeName )
148
+ test , err = tnf .NewTest (context .GetExpecter (), fsDiffTester , []reel.Handler {fsDiffTester }, context .GetErrorChannel ())
151
149
gomega .Expect (err ).To (gomega .BeNil ())
150
+ return test .Run ()
152
151
}
153
152
154
153
func getMcKernelArguments (context * interactive.Context , mcName string ) map [string ]string {
0 commit comments