Skip to content

Commit 5296d38

Browse files
committed
SLCORE-1116: Remove redundant token
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.
1 parent 62919e8 commit 5296d38

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

its/tests/src/test/java/its/SonarCloudTests.java

+1-10
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ class SonarCloudTests extends AbstractConnectedTests {
132132
private static final String SONARCLOUD_ORGANIZATION = "sonarlint-it";
133133
private static final String SONARCLOUD_TOKEN = System.getenv("SONARCLOUD_IT_TOKEN");
134134

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

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

147145
private static SonarLintRpcServer backend;
148146
private static SonarLintRpcClientDelegate client;
149-
private static String sonarcloudUserToken;
150147
private static final Set<String> openedConfigurationScopeIds = new HashSet<>();
151148
private static final Map<String, Boolean> analysisReadinessByConfigScopeId = new ConcurrentHashMap<>();
152149

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

175172
adminWsClient = newAdminWsClient();
176-
sonarcloudUserToken = adminWsClient.userTokens()
177-
.generate(new GenerateRequest().setName(TOKEN_NAME))
178-
.getToken();
179173

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

192186
@AfterAll
193187
static void cleanup() throws Exception {
194-
adminWsClient.userTokens()
195-
.revoke(new RevokeRequest().setName(TOKEN_NAME));
196-
197188
var request = new PostRequest("api/projects/bulk_delete");
198189
request.setParam("q", "-" + randomPositiveInt);
199190
request.setParam("organization", SONARCLOUD_ORGANIZATION);
@@ -629,7 +620,7 @@ private static void analyzeMavenProject(String projectKey, String projectDirName
629620
"-Dsonar.projectKey=" + projectKey,
630621
"-Dsonar.host.url=" + SONARCLOUD_STAGING_URL,
631622
"-Dsonar.organization=" + SONARCLOUD_ORGANIZATION,
632-
"-Dsonar.token=" + sonarcloudUserToken,
623+
"-Dsonar.token=" + SONARCLOUD_TOKEN,
633624
"-Dsonar.scm.disabled=true",
634625
"-Dsonar.branch.autoconfig.disabled=true");
635626

0 commit comments

Comments
 (0)