Skip to content

Commit cf524bc

Browse files
committed
Remove use of machine account in integration tests
1 parent c7a5526 commit cf524bc

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

horreum-integration-tests/src/test/java/io/hyperfoil/tools/horreum/it/HorreumClientIT.java

+4-23
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void testApiKeys() {
8181

8282
List<String> roles = apiClient.userService.getRoles();
8383
assertFalse(roles.isEmpty());
84-
assertTrue(roles.contains(TEST_TEAM.replace("team", Roles.TESTER)));
84+
assertTrue(roles.contains("dev-" + Roles.TESTER));
8585

8686
UserService.ApiKeyResponse apiKey = horreumClient.userService.apiKeys().get(0);
8787
assertFalse(apiKey.isRevoked);
@@ -376,8 +376,6 @@ protected static String resourceToString(String resourcePath) {
376376

377377
private static Test dummyTest;
378378

379-
private static final String TEST_USERNAME = "it-test-user", TEST_PASSWORD = "super-secret", TEST_TEAM = "it-team";
380-
381379
@Override
382380
public void beforeEach(QuarkusTestMethodContext context) {
383381
if (horreumClient == null) {
@@ -390,7 +388,7 @@ public void beforeEach(QuarkusTestMethodContext context) {
390388
Assertions.assertNull(dummyTest);
391389
Test test = new Test();
392390
test.name = "test";
393-
test.owner = TEST_TEAM;
391+
test.owner = "dev-team";
394392
test.description = "This is a dummy test";
395393
dummyTest = horreumClient.testService.add(test);
396394
Assertions.assertNotNull(dummyTest);
@@ -416,8 +414,8 @@ private void instantiateClient() {
416414
if (horreumClient == null) {
417415
horreumClient = new HorreumClient.Builder()
418416
.horreumUrl("http://localhost:".concat(System.getProperty("quarkus.http.test-port")))
419-
.horreumUser(TEST_USERNAME)
420-
.horreumPassword(TEST_PASSWORD)
417+
.horreumUser("horreum.bootstrap")
418+
.horreumPassword(ItResource.HORREUM_BOOTSTRAP_PASSWORD)
421419
.build();
422420

423421
Assertions.assertNotNull(horreumClient);
@@ -426,23 +424,6 @@ private void instantiateClient() {
426424

427425
@Override
428426
public void beforeClass(Class<?> testClass) {
429-
HorreumClient adminClient = new HorreumClient.Builder()
430-
.horreumUrl("http://localhost:".concat(System.getProperty("quarkus.http.test-port", "8081")))
431-
.horreumUser("horreum.bootstrap")
432-
.horreumPassword(ItResource.HORREUM_BOOTSTRAP_PASSWORD)
433-
.build();
434-
435-
adminClient.userService.addTeam(TEST_TEAM);
436-
437-
// create machine account to be used throughout the test
438-
UserService.NewUser testUser = new UserService.NewUser();
439-
testUser.user = new UserService.UserData("", TEST_USERNAME, "Test", "User", "[email protected]");
440-
testUser.team = TEST_TEAM;
441-
testUser.password = TEST_PASSWORD;
442-
testUser.roles = List.of(Roles.MACHINE, Roles.TESTER, Roles.UPLOADER);
443-
adminClient.userService.createUser(testUser);
444-
445-
adminClient.close();
446427
}
447428

448429
@Override

0 commit comments

Comments
 (0)