Skip to content

Commit

Permalink
[JENKINS-72611] Do not update credentials ID in BaseTest
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslavafenkin committed Mar 4, 2024
1 parent 1ef1c60 commit d01156f
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

public class BaseTest {

private static final String UPDATED_CRED_ID = "Custom-ID-Updated";
private static final String CRED_ID = "Custom-ID";

@Rule
Expand All @@ -50,7 +49,7 @@ public void setup(){
@Test
public void secretTextBaseTest() throws IOException {
StringCredentialsImpl credential = new StringCredentialsImpl(CredentialsScope.GLOBAL, CRED_ID, "Test Secret Text", Secret.fromString("password"));
StringCredentialsImpl updatedCredential = new StringCredentialsImpl(credential.getScope(), UPDATED_CRED_ID, credential.getDescription(), credential.getSecret());
StringCredentialsImpl updatedCredential = new StringCredentialsImpl(credential.getScope(), CRED_ID, credential.getDescription(), credential.getSecret());
testCreateUpdateDelete(credential, updatedCredential);
}

Expand All @@ -75,7 +74,7 @@ private void secretFileTest(boolean useDeprecatedConstructor) throws IOException
credential = new FileCredentialsImpl(CredentialsScope.GLOBAL, CRED_ID, "Test Secret file", fileItem, "keys.txt", SecretBytes.fromBytes(fileItem.get()));
}

FileCredentialsImpl updatedCredential = new FileCredentialsImpl(credential.getScope(), UPDATED_CRED_ID, credential.getDescription(), fileItem, credential.getFileName(), credential.getSecretBytes());
FileCredentialsImpl updatedCredential = new FileCredentialsImpl(credential.getScope(), CRED_ID, credential.getDescription(), fileItem, credential.getFileName(), credential.getSecretBytes());
testCreateUpdateDelete(credential, updatedCredential);
}

Expand Down Expand Up @@ -108,7 +107,7 @@ private <T extends BaseStandardCredentials> void testCreateUpdateDelete(T creden
assertThat(credentials.size(), is(1));
cred = credentials.get(0);
assertThat(cred, instanceOf(credential.getClass()));
assertThat(cred.getId(), is(UPDATED_CRED_ID));
assertThat(cred.getId(), is(CRED_ID));

// Delete credential
store.removeCredentials(Domain.global(), cred);
Expand Down

0 comments on commit d01156f

Please sign in to comment.