Skip to content

Commit

Permalink
SLCORE-1116: Remove redundant token
Browse files Browse the repository at this point in the history
Since we already use a token for authentication, we don't have to create a new one. Otherwise on test failures they might pile up.
  • Loading branch information
thahnen committed Jan 30, 2025
1 parent ac4e41d commit 0139262
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions its/tests/src/test/java/its/SonarCloudTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ class SonarCloudTests extends AbstractConnectedTests {
private static final String SONARCLOUD_ORGANIZATION = "sonarlint-it";
private static final String SONARCLOUD_TOKEN = System.getenv("SONARCLOUD_IT_TOKEN");

private static final String TIMESTAMP = Long.toString(Instant.now().toEpochMilli());
private static final String TOKEN_NAME = "SLCORE-IT-" + TIMESTAMP;
private static final String PROJECT_KEY_JAVA = "sample-java";

public static final String CONNECTION_ID = "sonarcloud";
Expand All @@ -146,7 +144,6 @@ class SonarCloudTests extends AbstractConnectedTests {

private static SonarLintRpcServer backend;
private static SonarLintRpcClientDelegate client;
private static String sonarcloudUserToken;
private static final Set<String> openedConfigurationScopeIds = new HashSet<>();
private static final Map<String, Boolean> analysisReadinessByConfigScopeId = new ConcurrentHashMap<>();

Expand All @@ -173,9 +170,6 @@ static void prepare() throws Exception {
randomPositiveInt = new Random().nextInt() & Integer.MAX_VALUE;

adminWsClient = newAdminWsClient();
sonarcloudUserToken = adminWsClient.userTokens()
.generate(new GenerateRequest().setName(TOKEN_NAME))
.getToken();

restoreProfile("java-sonarlint.xml");
provisionProject(PROJECT_KEY_JAVA, "Sample Java");
Expand All @@ -191,9 +185,6 @@ static void prepare() throws Exception {

@AfterAll
static void cleanup() throws Exception {
adminWsClient.userTokens()
.revoke(new RevokeRequest().setName(TOKEN_NAME));

var request = new PostRequest("api/projects/bulk_delete");
request.setParam("q", "-" + randomPositiveInt);
request.setParam("organization", SONARCLOUD_ORGANIZATION);
Expand Down Expand Up @@ -629,7 +620,7 @@ private static void analyzeMavenProject(String projectKey, String projectDirName
"-Dsonar.projectKey=" + projectKey,
"-Dsonar.host.url=" + SONARCLOUD_STAGING_URL,
"-Dsonar.organization=" + SONARCLOUD_ORGANIZATION,
"-Dsonar.token=" + sonarcloudUserToken,
"-Dsonar.token=" + SONARCLOUD_TOKEN,
"-Dsonar.scm.disabled=true",
"-Dsonar.branch.autoconfig.disabled=true");

Expand Down

0 comments on commit 0139262

Please sign in to comment.