Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests #286

Merged
merged 1 commit into from
Dec 22, 2023
Merged

Fix unit tests #286

merged 1 commit into from
Dec 22, 2023

Conversation

nwneisen
Copy link
Collaborator

@nwneisen nwneisen commented Dec 8, 2023

Unit tests were not getting ran in CI and so they haven't been getting updated for a while. This PR updates the tests for recent changes that they are now passing.

Proposed Changes

  • Update all packages to 0.27.8 so that they are in sync with k8s.io/kubernetes 1.27.8 regardless of CVE fixes
  • Add a second definition for k8s.io/cri-api so that v1alpha2 can still be used
  • Fix method definitions and imports for k8s.io/kubernetes updates
  • Update seccomp strings to use the seccomd structure from Migrate seccomp profile #223
  • Remove extra method calls from stats test after Improve container and imagefs stats #233

@nwneisen nwneisen marked this pull request as ready for review December 11, 2023 05:38
@nwneisen nwneisen mentioned this pull request Dec 11, 2023
@vikramhh
Copy link

@nwneisen - on Mac I see the following with and without the PR:

~/gopath/src/github.com/Mirantis/cri-dockerd/core>  go test  
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] Unable to create pod sandbox due to conflict. Attempting to remove sandbox. Container containerid 
ERRO[0000] Failed to remove the conflicting container (containerid): container not stopped 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] Unable to create pod sandbox due to conflict. Attempting to remove sandbox. Container containerid 
ERRO[0000] Failed to remove the conflicting container (containerid): random error 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] Unable to create pod sandbox due to conflict. Attempting to remove sandbox. Container containerid 
ERRO[0000] Failed to remove the conflicting container (containerid): Error response from daemon: No such container: containerid 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] updateCreateConfig is unsupported in this build 
INFO[0000] getSecurityOpts is unsupported in this build 
INFO[0000] Pulling the image without credentials. Image: gcr.io/test/image 
INFO[0000] Pulling the image without credentials. Image: gcr.io/test/image 
INFO[0000] Unknown propagation mode for hostPath /mnt/7 
INFO[0000] Pulling the image without credentials. Image: registry.k8s.io/pause:3.6 
INFO[0000] getSandBoxSecurityOpts is unsupported in this build 
INFO[0000] getSandBoxSecurityOpts is unsupported in this build 
INFO[0000] getSandBoxSecurityOpts is unsupported in this build 
INFO[0000] Pulling the image without credentials. Image: registry.k8s.io/pause:3.6 
INFO[0000] getSandBoxSecurityOpts is unsupported in this build 
INFO[0000] determinePodIPBySandboxID is unsupported in this build 
INFO[0000] Failed to read pod IP from plugin/docker: Couldn't find network status for bar/foo through plugin: invalid network status for 
INFO[0000] determinePodIPBySandboxID is unsupported in this build 
INFO[0000] getSandBoxSecurityOpts is unsupported in this build 
--- FAIL: TestSandboxHasLeastPrivilegesConfig (0.00s)
    sandbox_helpers_test.go:196: 
        	Error Trace:	/Users/vikramharinau/gopath/src/github.com/Mirantis/cri-dockerd/core/sandbox_helpers_test.go:196
        	Error:      	Not equal: 
        	            	expected: 0
        	            	actual  : 1
        	Test:       	TestSandboxHasLeastPrivilegesConfig
        	Messages:   	sandbox should use runtime/default
panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: runtime error: index out of range [0] with length 0

goroutine 2167 [running]:
testing.tRunner.func1.2({0x2414f60, 0xc00013be90})
	/usr/local/opt/go/libexec/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
	/usr/local/opt/go/libexec/src/testing/testing.go:1548 +0x397
panic({0x2414f60?, 0xc00013be90?})
	/usr/local/opt/go/libexec/src/runtime/panic.go:914 +0x21f
github.com/Mirantis/cri-dockerd/core.TestSandboxHasLeastPrivilegesConfig(0xc000683380?)
	/Users/vikramharinau/gopath/src/github.com/Mirantis/cri-dockerd/core/sandbox_helpers_test.go:205 +0x1f9
testing.tRunner(0xc000683ba0, 0x2634af8)
	/usr/local/opt/go/libexec/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
	/usr/local/opt/go/libexec/src/testing/testing.go:1648 +0x3ad
exit status 2
FAIL	github.com/Mirantis/cri-dockerd/core	0.444s

~/gopath/src/github.com/Mirantis/cri-dockerd/core>  go test  
# k8s.io/kubernetes/pkg/kubelet/container
../vendor/k8s.io/kubernetes/pkg/kubelet/container/helpers.go:42:81: undefined: v1.Handler
FAIL	github.com/Mirantis/cri-dockerd/core [build failed]

Given Mac is oftentimes used for dev work, I found it worthwhile to mention here in case someone runs into this.

@nwneisen
Copy link
Collaborator Author

@vikramhh Mac falls into the unsupported category. Especially since nobody us running a Mac cloud.

If someone with a Mac is concerned about it, then they will have to step up and take ownership of supporting Mac.

Copy link

@vikramhh vikramhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I am not able to get what the reference to Remove stra method calls in the PR description is about. You may want to edit it in case there is a typo etc.

@nwneisen nwneisen merged commit ff375cf into Mirantis:master Dec 22, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants