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: e2e test to use conftest command instead version-specific command #2851

Conversation

krrrr38
Copy link
Contributor

@krrrr38 krrrr38 commented Dec 22, 2022

what

  • use conftest command instead conftest$version command in the e2e test
  • conftest_client try to find conftest command if version is not specified

why

discussion

references

@krrrr38 krrrr38 requested a review from a team as a code owner December 22, 2022 12:11
conftextExec := policy.NewConfTestExecutorWorkflow(logger, binDir, &NoopTFDownloader{})

// swapping out version cache to something that always returns local contest
// binary
conftextExec.VersionCache = &LocalConftestCache{}

policyCheckRunner, err := runtime.NewPolicyCheckStepRunner(
conftestVersion,
defaultTFVersion,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

asis impl is invalid. runtime.NewPolicyCheckStepRunner first parameter is defaultTfVersion.

func (m *LocalConftestCache) Get(key *version.Version) (string, error) {
return exec.LookPath(fmt.Sprintf("conftest%s", ConftestVersion))
func (m *LocalConftestCache) Get(_ *version.Version) (string, error) {
return exec.LookPath(conftestCommand)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a main change in this PR. In e2e test, use conftest command.

@krrrr38 krrrr38 marked this pull request as draft December 22, 2022 12:15
@krrrr38 krrrr38 force-pushed the refactor-e2e-no-conftest-version-dependency branch from 408e587 to bc595ce Compare December 22, 2022 12:36
@krrrr38 krrrr38 marked this pull request as ready for review December 22, 2022 12:36
@krrrr38 krrrr38 force-pushed the refactor-e2e-no-conftest-version-dependency branch from bc595ce to 3862f45 Compare December 22, 2022 12:40
@krrrr38 krrrr38 force-pushed the refactor-e2e-no-conftest-version-dependency branch from 3862f45 to 07c9de0 Compare December 22, 2022 12:45
Copy link
Member

@nitrocode nitrocode left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this test issue!

@nitrocode nitrocode changed the title refactor: e2e test use conftest command instead version specific conftest command tests: e2e test to use conftest command instead version-specific command Dec 22, 2022
@nitrocode nitrocode merged commit b78c4e8 into runatlantis:main Dec 22, 2022
@nitrocode nitrocode added this to the 0.22.0 milestone Dec 23, 2022
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.

Tests requiring the conftest binary fail with newer versions of the utility
2 participants