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

test(aws): move part of unit tests to integration #4884

Merged
merged 5 commits into from
Aug 2, 2023

Conversation

nikpivkin
Copy link
Contributor

Description

Moved part of the unit tests that depend on the environment settings to the integration ones.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@nikpivkin nikpivkin marked this pull request as ready for review July 31, 2023 13:54
Comment on lines -1004 to 985
{
name: "try to call aws if cache is expired",
options: flag.Options{
RegoOptions: flag.RegoOptions{SkipPolicyUpdate: true},
AWSOptions: flag.AWSOptions{
Region: "us-east-1",
Services: []string{"s3"},
Account: "12345678",
},
CloudOptions: flag.CloudOptions{
MaxCacheAge: time.Minute,
},
},
cacheContent: "testdata/s3onlycache.json",
expectErr: true,
},
{
Copy link
Member

Choose a reason for hiding this comment

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

Did you miss moving this test case over?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@simar7
This test was successful because an error occurred due to the lack of credentials. I don't think this test is relevant at the moment, because if the cache has expired, then this error is ignored and all passed services are scanned.

@simar7 simar7 self-requested a review August 2, 2023 03:42
@simar7 simar7 added this pull request to the merge queue Aug 2, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 2, 2023
@knqyf263 knqyf263 enabled auto-merge August 2, 2023 12:36
auto-merge was automatically disabled August 2, 2023 14:10

Head branch was pushed to by a user without write access

@nikpivkin nikpivkin requested a review from knqyf263 August 2, 2023 14:35
@simar7
Copy link
Member

simar7 commented Aug 2, 2023

The PR was removed from the merge queue due to a failing test, but that test that failed seems unrelated

=== RUN   TestContainerd_LocalImage
2023/08/02 11:30:04 🐳 Creating container for image ghcr.io/aquasecurity/trivy-test-images/containerd:latest
2023/08/02 11:30:04 ✅ Container created: e19a56b35e7d
2023/08/02 11:30:04 🐳 Starting container: e19a56b35e7d
2023/08/02 11:30:05 ✅ Container started: e19a56b35e7d
2023/08/02 11:30:05 🚧 Waiting for container id e19a56b35e7d image: ghcr.io/aquasecurity/trivy-test-images/containerd:latest. Waiting for: &{timeout:<nil> Log:containerd successfully booted Occurrence:1 PollInterval:100ms}
    containerd_test.go:264: 
        	Error Trace:	/home/runner/work/trivy/trivy/pkg/fanal/test/integration/containerd_test.go:658
        	            				/home/runner/work/trivy/trivy/pkg/fanal/test/integration/containerd_test.go:264
        	Error:      	Received unexpected error:
        	            	failed to dial "/tmp/fanal3109783308/containerd/containerd.sock": connection error: desc = "transport: error while dialing: dial unix /tmp/fanal3109783308/containerd/containerd.sock: connect: permission denied"
        	Test:       	TestContainerd_LocalImage
2023/08/02 11:30:05 🐳 Terminating container: e19a56b35e7d
2023/08/02 11:30:05 🚫 Container terminated: e19a56b35e7d
--- FAIL: TestContainerd_LocalImage (0.74s)

I'm going to try to requeue this PR for merging again.

@simar7 simar7 added this pull request to the merge queue Aug 2, 2023
Merged via the queue into aquasecurity:main with commit 39ccbf7 Aug 2, 2023
12 checks passed
@simar7 simar7 modified the milestone: v0.44.1 Aug 2, 2023
AnaisUrlichs pushed a commit to AnaisUrlichs/trivy that referenced this pull request Aug 10, 2023
* test(aws): move part of unit tests to integration

* fix typo

* fix test

---------

Co-authored-by: knqyf263 <knqyf263@gmail.com>
@nikpivkin nikpivkin deleted the nik-aws-tests branch August 15, 2023 04:39
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.

fix(test): Test_Run (aws) fluky test
3 participants