Skip to content

test: remove flaky test due to map ordering randomness#119

Merged
clemfromspace merged 2 commits into
mainfrom
test-fix-remove_test-flaky
Apr 4, 2023
Merged

test: remove flaky test due to map ordering randomness#119
clemfromspace merged 2 commits into
mainfrom
test-fix-remove_test-flaky

Conversation

@Nagriar
Copy link
Copy Markdown
Member

@Nagriar Nagriar commented Apr 4, 2023

Summary

Fix flaky test:

    remove_test.go:149: 
        	Error Trace:	/home/runner/work/cli/cli/pkg/cmd/profile/remove/remove_test.go:149
        	Error:      	Not equal: 
        	            	expected: "✓ 'foo' removed successfully.\n"
        	            	actual  : "✓ 'foo' removed successfully. Set a new default profile with 'algolia profile setdefault'.\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1,2 +1,2 @@
        	            	-✓ 'foo' removed successfully.
        	            	+✓ 'foo' removed successfully. Set a new default profile with 'algolia profile setdefault'.
        	            	 
        	Test:       	Test_runRemoveCmd/existing_profile_(non-default)

This test is flaky due to the go maps which doesn't have a predictable order and the function test.NewConfigStubWithProfiles relies on the order to define the profile used. This PR leverages a slice to have a predictable ordering

Copy link
Copy Markdown
Contributor

@clemfromspace clemfromspace left a comment

Choose a reason for hiding this comment

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

Thanks 🙇

@clemfromspace clemfromspace merged commit 5c111ba into main Apr 4, 2023
@Nagriar Nagriar deleted the test-fix-remove_test-flaky branch April 4, 2023 17:04
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.

2 participants