Skip to content

Commit

Permalink
Trying to fix tests.. again
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-munro committed Feb 28, 2022
1 parent f85c6d8 commit 68aba86
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .kokoro/nightly/samples.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ env_vars: {
value: "true"
}

# This service account we want to be any valid account not used for
# GOOGLE_APPLICATION_CREDENTIALS in the tests
env_vars: {
key: "IT_SERVICE_ACCOUNT_EMAIL"
value: "java-docs-samples-testing@java-docs-samples-testing.iam.gserviceaccount.com"
value: "samples@java-docs-samples-testing.iam.gserviceaccount.com"
}
4 changes: 3 additions & 1 deletion .kokoro/presubmit/samples.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ env_vars: {
value: "java-docs-samples-service-account"
}

# This service account we want to be any valid account not used for
# GOOGLE_APPLICATION_CREDENTIALS in the tests
env_vars: {
key: "IT_SERVICE_ACCOUNT_EMAIL"
value: "java-docs-samples-testing@java-docs-samples-testing.iam.gserviceaccount.com"
value: "samples@java-docs-samples-testing.iam.gserviceaccount.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ public void testAddFileOwner() {
// Check for user email before the actual test.
assertNotNull("Unable to determine user email", IT_SERVICE_ACCOUNT_EMAIL);

// Make sure the User has Ownership permissions on the bucket.
Acl bucketOwner = Acl.of(new User(IT_SERVICE_ACCOUNT_EMAIL), Role.OWNER);
bucket.createAcl(bucketOwner);

// Add Ownership to the file.
AddFileOwner.addFileOwner(bucketName, IT_SERVICE_ACCOUNT_EMAIL, blobName);
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(IT_SERVICE_ACCOUNT_EMAIL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ public void testRemoveFileOwner() {
// Check for user email before the actual test.
assertNotNull("Unable to determine user email", IT_SERVICE_ACCOUNT_EMAIL);

// Make sure the User has Ownership permissions on the bucket.
Acl bucketOwner = Acl.of(new User(IT_SERVICE_ACCOUNT_EMAIL), Role.OWNER);
bucket.createAcl(bucketOwner);

// Add User as Owner
Acl newFileOwner = Acl.of(new User(IT_SERVICE_ACCOUNT_EMAIL), Role.OWNER);
blob.createAcl(newFileOwner);
Expand All @@ -51,6 +47,9 @@ public void testRemoveFileOwner() {

@Test
public void testUserNotFound() {
// Check for user email before the actual test.
assertNotNull("Unable to determine user email", IT_SERVICE_ACCOUNT_EMAIL);

// Remove User without Owner Permissions
RemoveFileOwner.removeFileOwner(bucketName, IT_SERVICE_ACCOUNT_EMAIL, blobName);
assertThat(stdOut.getCapturedOutputAsUtf8String()).contains(IT_SERVICE_ACCOUNT_EMAIL);
Expand Down

0 comments on commit 68aba86

Please sign in to comment.