minder icon indicating copy to clipboard operation
minder copied to clipboard

tests using createRandomOrganization occasionally create invalid org names

Open blkt opened this issue 1 year ago • 4 comments

Describe the issue

Tests using createRandomOrganization occasionally run into a key violation due to this line creating identical names when lower-cased.

  ❌ TestCreateProfileStatusMultiRuleTransitions/0x87 (30ms)
    profiles_test.go:2802:
        	Error Trace:	/Users/michelangelo/stacklok/minder/internal/db/organizations_test.go:42
        	            				/Users/michelangelo/stacklok/minder/internal/db/profiles_test.go:179
        	            				/Users/michelangelo/stacklok/minder/internal/db/profiles_test.go:2802
        	Error:      	Received unexpected error:
        	            	pq: duplicate key value violates unique constraint "project_name_lower_idx"
        	Test:       	TestCreateProfileStatusMultiRuleTransitions/0x87

This is a minor issue.

To Reproduce

Running this repeatedly should trigger the error. Note that the test is currently in a PR under review.

$ go test -json -race -v ./internal/db/... -run "TestCreateProfileStatusMultiRuleTransitions" | gotestfmt

What version are you using?

main

blkt avatar May 10 '24 07:05 blkt

@blkt is this still a problem?

evankanderson avatar Jul 30 '24 13:07 evankanderson

Yes, but very unlikely to happen. I believe we can close it.

blkt avatar Jul 30 '24 19:07 blkt

I got this error another time today, so it happened twice in a quarter. :D

  ❌ TestCreateProfileStatusMultiRuleTransitions/0x16 (20ms)
    profiles_test.go:3010:
        	Error Trace:	/Users/michelangelo/stacklok/minder/internal/db/organizations_test.go:42
        	            				/Users/michelangelo/stacklok/minder/internal/db/profiles_test.go:255
        	            				/Users/michelangelo/stacklok/minder/internal/db/profiles_test.go:3010
        	Error:      	Received unexpected error:
        	            	pq: duplicate key value violates unique constraint "project_name_lower_idx"
        	Test:       	TestCreateProfileStatusMultiRuleTransitions/0x16

blkt avatar Aug 19 '24 08:08 blkt

Looks like this is probably still a low-occurrence bug.

evankanderson avatar Dec 17 '24 14:12 evankanderson