Skip to content

Tests using --update arg cannot be called more than once #1106

@kirecek

Description

@kirecek

Hello,

I tried to test conftest with remote policies using --update flag. However, it seems update cannot be called multiple times because it conflicts with previously downloaded tests.

First run works:

conftest test --update https://raw.githubusercontent.com/kirecek/policy-test/refs/heads/main/policy/main.rego main.tf

3 tests, 3 passed, 0 warnings, 0 failures, 0 exceptions

Second run fails as policy is already there.

conftest test --update https://raw.githubusercontent.com/kirecek/policy-test/refs/heads/main/policy/main.rego main.tf

Error: running test: update policies: policy file already exists at policy/policy-test, refusing to overwrite

Which is set by downloader code:

return fmt.Errorf("policy file already exists at %s, refusing to overwrite", targetPath)

I'm wondering if it would make sense to keep those policies in separate (tmp) directory or introduce some flag to clean downloaded policies?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions