Skip to content

Conversation

@myskov
Copy link
Contributor

@myskov myskov commented Dec 29, 2023

What changes were proposed in this pull request?

I added exception handling on S3 secret generation.
Also, I had to refactor robot tests on secret generation/revoke to isolate them and make them more readable. Previously, "revoke" tests were dependent on "generate" tests.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-10014

How was this patch tested?

added a unit test and an acceptance test

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @myskov for the patch.

Maksim Myskov and others added 2 commits January 2, 2024 11:15
@adoroszlai
Copy link
Contributor

Thanks @myskov for updating the patch.

@ChenSammi @ivanzlenko would you like to take a look?

Test Timeout 5 minutes
Suite Setup Setup s3 tests
Default Tags no-bucket-type
Test Setup Run Keywords Kinit test user testuser testuser.keytab
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should revoke secret for testuser as well, just in case.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ivanzlenko Revoke S3 secrets (called in the next line) does revoke for testuser, too, so this is fine.

Test Timeout 5 minutes
Suite Setup Setup s3 tests
Default Tags no-bucket-type
Test Setup Run Keyword Setup v4 headers
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we generate secret beforehand?

assertEquals(USER_SECRET, response.getAwsSecret());
assertEquals(USER_NAME, response.getAwsAccessKey());
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test to check 500 will be thrown for other exceptions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can be done in follow-up if needed.

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks again @myskov for the patch. Based on @ivanzlenko's comments I took another look.

S3 Gateway Revoke Secret
Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit HTTP user
Pass Execution If '${SECURITY_ENABLED}' == 'false' Skipping this check as security is not enabled
${result} = Execute curl -X DELETE --negotiate -u : -v ${ENDPOINT_URL}/secret
Copy link
Contributor

Choose a reason for hiding this comment

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

I think @ivanzlenko is right, [setup] to generate secret is missing here.

Should contain ${result} S3 Secret endpoint is disabled.
END
Pass Execution If '${SECURITY_ENABLED}' == 'false' Skipping this check as security is not enabled
[Setup] Execute curl -X PUT --negotiate -u : -v ${ENDPOINT_URL}/secret/testuser
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I think it would be better if setup used CLI to generate the secret, not HTTP. (Similarly to how secretgenerate.robot uses CLI to revoke in setup/teardown.)

END
Pass Execution If '${SECURITY_ENABLED}' == 'false' Skipping this check as security is not enabled
[Setup] Execute curl -X PUT --negotiate -u : -v ${ENDPOINT_URL}/secret/testuser
${result} = Execute curl -X DELETE --negotiate -u : -v ${ENDPOINT_URL}/secret/testuser
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep "by username" test case generate/revoke for testuser2? Since testuser is executing the test case, this verifies it works for other user.

Should contain ${result} S3 Secret endpoint is disabled.
END
Pass Execution If '${SECURITY_ENABLED}' == 'false' Skipping this check as security is not enabled
${result} = Execute curl -X PUT --negotiate -u : -v ${ENDPOINT_URL}/secret/testuser
Copy link
Contributor

Choose a reason for hiding this comment

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

Also here, can we keep testuser2?

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @myskov for updating the patch. Thanks @ivanzlenko for the review.

@adoroszlai adoroszlai merged commit 27c1f9c into apache:master Jan 21, 2024
Tejaskriya pushed a commit to Tejaskriya/ozone that referenced this pull request Jan 24, 2024
adoroszlai pushed a commit to adoroszlai/ozone that referenced this pull request Feb 21, 2024
adoroszlai pushed a commit to adoroszlai/ozone that referenced this pull request Feb 21, 2024
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.

3 participants