@@ -32,7 +32,6 @@ import (
3232 "github.com/onsi/ginkgo"
3333 ginkgoconfig "github.com/onsi/ginkgo/config"
3434 "github.com/onsi/gomega"
35- log "github.com/sirupsen/logrus"
3635 "github.com/test-network-function/test-network-function/pkg/tnf"
3736 "github.com/test-network-function/test-network-function/pkg/tnf/handlers/base/redhat"
3837 "github.com/test-network-function/test-network-function/pkg/tnf/handlers/cnffsdiff"
@@ -116,23 +115,25 @@ func testContainerIsRedHatRelease(cut *config.Container) {
116115func testContainersFsDiff (env * config.TestEnvironment ) {
117116 testID := identifiers .XformToGinkgoItIdentifier (identifiers .TestUnalteredBaseImageIdentifier )
118117 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 ))
127129 }
128- } else {
129- log .Warn ("no fs diff container is configured, cannot run fs diff test" )
130130 }
131+ gomega .Expect (badContainers ).To (gomega .BeNil ())
131132 })
132133}
133134
134135// 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 ) {
136137 defer results .RecordResult (identifiers .TestUnalteredBaseImageIdentifier )
137138 targetContainerOC .GetExpecter ()
138139 containerIDTester := containerid .NewContainerID (common .DefaultTimeout )
@@ -142,13 +143,11 @@ func testContainerFsDiff(masterPodOc, targetContainerOC *interactive.Oc) {
142143 gomega .Expect (testResult ).To (gomega .Equal (tnf .SUCCESS ))
143144 gomega .Expect (err ).To (gomega .BeNil ())
144145 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 ())
151149 gomega .Expect (err ).To (gomega .BeNil ())
150+ return test .Run ()
152151}
153152
154153func getMcKernelArguments (context * interactive.Context , mcName string ) map [string ]string {
0 commit comments