Set the Read permission state as Unknown if the response from the list calls does not find the expected key

This commit is contained in:
Elim Tsiagbey committed 2024-07-24 11:34:03 -04:00
1 parent f51527937f
commit 544573ebce
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -820,6 +820,7 @@ func dryRunValidation(ctx context.Context, state *awsStoragePersistedState, attr
st, permissions.Read = errors.ParseAWSError(err, "failed to list object")
errs = multierror.Append(errs, st.Err())
} else if res == nil || len(res.Contents) != 1 || *res.Contents[0].Key != objectKey {
permissions.Read = &pb.Permission{State: pb.StateType_STATE_TYPE_UNKNOWN, CheckedAt: timestamppb.Now()}
errs = multierror.Append(errs, status.New(codes.Aborted, fmt.Sprintf("list response did not contain the expected key: %+v", res)).Err())
}
+1 -1
View File
@@ -2688,7 +2688,7 @@ func TestStoragePlugin_ValidatePermissions(t *testing.T) {
expectedDetails: &pb.StorageBucketCredentialState{
State: &pb.Permissions{
Read: &pb.Permission{
State: pb.StateType_STATE_TYPE_OK,
State: pb.StateType_STATE_TYPE_UNKNOWN,
CheckedAt: timestamppb.Now(),
},
Write: &pb.Permission{