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

mcs add tests for groups and mock same function twice #41

Merged
merged 1 commit into from Apr 6, 2020

Conversation

cesnietor
Copy link
Collaborator

Add test for function that uses the same function to mock twice.
basically it justs uses a flag:

// groupUpdate uses getInfo() twice which uses getGroupDescription() so we need to mock as if it called
	// the function twice but the second time returned an error
	is2ndRunGroupInfo := false
	// mock function response from updateGroupMembers()
	minioGetGroupDescriptionMock = func(group string) (*madmin.GroupDesc, error) {
		if is2ndRunGroupInfo {
			return mockResponseAfterUpdate, nil
		}
		is2ndRunGroupInfo = true
		return mockResponseBeforeUpdate, nil
	}

@cesnietor cesnietor self-assigned this Apr 6, 2020
Copy link
Collaborator

@bexsoft bexsoft left a comment

Choose a reason for hiding this comment

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

LGTM

@cesnietor cesnietor merged commit 31f0655 into minio:master Apr 6, 2020
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.

None yet

2 participants