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

Actually run unit tests #3773

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rgmz
Copy link
Contributor

@rgmz rgmz commented Dec 12, 2024

Description:

Unit tests don't get run outside of a few circumstances because pkg/detectors is filtered.

Also, several integration tests were missing build tags.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@rgmz rgmz requested review from a team as code owners December 12, 2024 22:20
@rgmz rgmz force-pushed the ci/run-unit-tests branch from f7da488 to 98bc643 Compare December 12, 2024 22:26
Copy link
Contributor

@kashifkhan0771 kashifkhan0771 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 adding the missing tags @rgmz

@rgmz rgmz force-pushed the ci/run-unit-tests branch from 98bc643 to 9da3dd9 Compare December 13, 2024 14:30
@rgmz
Copy link
Contributor Author

rgmz commented Dec 13, 2024

@mcastorina This test is failing; not sure why.

Edit: it looks like #3308 changed the logic in a way that subtly broke the test.

--- FAIL: TestEmbeddedEndpointSetter (0.00s)
    endpoint_customizer_test.go:12: 
                Error Trace:    /tmp/trufflehog/pkg/detectors/endpoint_customizer_test.go:12
                Error:          Not equal: 
                                expected: []string{"baz"}
                                actual  : []string(nil)
                                
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,4 +1,2 @@
                                -([]string) (len=1) {
                                - (string) (len=3) "baz"
                                -}
                                +([]string) <nil>
                                 
                Test:           TestEmbeddedEndpointSetter
FAIL

assert.Equal(t, []string{"baz"}, s.Endpoints("baz"))

Copy link
Collaborator

@rosecodym rosecodym left a comment

Choose a reason for hiding this comment

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

Were the modified tests changed to make them pass?

)

func TestAzure_Pattern(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this deleted on purpose?

@rgmz
Copy link
Contributor Author

rgmz commented Dec 13, 2024

Were the modified tests changed to make them pass?

Yes.

Was this deleted on purpose?

Yes, the tests didn't actually work. More coverage is added in #3722.

@rgmz rgmz force-pushed the ci/run-unit-tests branch from 9da3dd9 to 5ba24e1 Compare December 15, 2024 15:27
@rgmz
Copy link
Contributor Author

rgmz commented Dec 20, 2024

@mcastorina This test is failing; not sure why.

Edit: it looks like #3308 changed the logic in a way that subtly broke the test.

This is currently the only failing test. Is it something that can be fixed in another PR?

 --- FAIL: TestEmbeddedEndpointSetter (0.00s)
    endpoint_customizer_test.go:12: 
        	Error Trace:	/home/runner/work/trufflehog/trufflehog/pkg/detectors/endpoint_customizer_test.go:12
        	Error:      	Not equal: 
        	            	expected: []string{"baz"}
        	            	actual  : []string(nil)
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,4 +1,2 @@
        	            	-([]string) (len=1) {
        	            	- (string) (len=3) "baz"
        	            	-}
        	            	+([]string) <nil>
        	            	 
        	Test:       	TestEmbeddedEndpointSetter

@rgmz rgmz force-pushed the ci/run-unit-tests branch 2 times, most recently from b0eea95 to 8817b1e Compare December 25, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants