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

Tests (compare of exec.Command in gomock) fail on Go1.20 #453

Closed
zhsj opened this issue Jan 18, 2023 · 0 comments · Fixed by #457
Closed

Tests (compare of exec.Command in gomock) fail on Go1.20 #453

zhsj opened this issue Jan 18, 2023 · 0 comments · Fixed by #457

Comments

@zhsj
Copy link
Contributor

zhsj commented Jan 18, 2023

Hi, with Go1.20, I fail to run the tests on master.

For example,

$ go test -v -run '^TestRunYumUpdateWithSecurity$' ./ospatch/
=== RUN   TestRunYumUpdateWithSecurity
    yum.go:160: Unexpected call to *utilmocks.MockCommandRunner.Run([context.Background /usr/bin/yum check-update --assumeyes]) at /tmp/t/osconfig/packages/yum.go:160 because: 
        expected call at /tmp/t/osconfig/ospatch/yum_update_test.go:52 doesn't match the argument at index 1.
        Got: /usr/bin/yum check-update --assumeyes (*exec.Cmd)
        Want: is equal to /usr/bin/yum check-update --assumeyes (*exec.Cmd)
        expected call at /tmp/t/osconfig/ospatch/yum_update_test.go:54 doesn't match the argument at index 1.
        Got: /usr/bin/yum check-update --assumeyes (*exec.Cmd)
        Want: is equal to /usr/bin/yum install --assumeyes foo (*exec.Cmd)
        expected call at /tmp/t/osconfig/ospatch/yum_update_test.go:57 doesn't match the argument at index 1.
        Got: /usr/bin/yum check-update --assumeyes (*exec.Cmd)
        Want: is equal to /usr/bin/yum update --assumeno --cacheonly --color=never --security (*exec.Cmd)
    controller.go:269: missing call(s) to *utilmocks.MockCommandRunner.Run(is equal to context.Background (*context.emptyCtx), is equal to /usr/bin/yum check-update --assumeyes (*exec.Cmd)) /tmp/t/osconfig/ospatch/yum_update_test.go:52
    controller.go:269: missing call(s) to *utilmocks.MockCommandRunner.Run(is equal to context.Background (*context.emptyCtx), is equal to /usr/bin/yum install --assumeyes foo (*exec.Cmd)) /tmp/t/osconfig/ospatch/yum_update_test.go:54
    controller.go:269: missing call(s) to *utilmocks.MockCommandRunner.Run(is equal to context.Background (*context.emptyCtx), is equal to /usr/bin/yum update --assumeno --cacheonly --color=never --security (*exec.Cmd)) /tmp/t/osconfig/ospatch/yum_update_test.go:57
    controller.go:269: aborting test due to missing call(s)
--- FAIL: TestRunYumUpdateWithSecurity (0.01s)
FAIL
FAIL    github.com/GoogleCloudPlatform/osconfig/ospatch 0.016s
FAIL

I think it's because Go1.20 adds a function to exec.Command struct, which is not comparable.
golang/go@55eaae4

zhsj added a commit to zhsj/osconfig that referenced this issue Feb 8, 2023
zhsj added a commit to zhsj/osconfig that referenced this issue Feb 9, 2023
zhsj added a commit to zhsj/osconfig that referenced this issue Mar 1, 2023
adjackura pushed a commit that referenced this issue Mar 16, 2023
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 a pull request may close this issue.

1 participant