Skip to content

Commit

Permalink
Add MySQL XA_RECOVER_ADMIN permission to baremetal naryana tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jedla97 authored and fedinskiy committed Feb 28, 2024
1 parent b317cf6 commit 56c0792
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package io.quarkus.ts.transactions;

import static io.quarkus.test.services.containers.DockerContainerManagedResource.DOCKER_INNER_CONTAINER;

import java.io.IOException;

import org.junit.jupiter.api.Tag;
import org.testcontainers.containers.GenericContainer;

import io.quarkus.test.bootstrap.MySqlService;
import io.quarkus.test.bootstrap.RestService;
Expand All @@ -15,9 +20,22 @@
public class MysqlTransactionGeneralUsageIT extends TransactionCommons {

static final int MYSQL_PORT = 3306;

@Container(image = "${mysql.80.image}", port = MYSQL_PORT, expectedLog = "port: " + MYSQL_PORT)
static final MySqlService database = new MySqlService();
static final MySqlService database = new MySqlService().onPostStart(service -> {
// enable transactions recovery for user
var self = (MySqlService) service;
// RH MySQL image allow login root user locally without using password and ignoring set root password
String passwordString = System.getProperty("mysql.80.image").contains("redhat") ? "" : "-p" + self.getPassword();
try {
self
.<GenericContainer<?>> getPropertyFromContext(DOCKER_INNER_CONTAINER)
.execInContainer(
"/bin/mysql", "-u", "root", passwordString, "-e",
"grant XA_RECOVER_ADMIN on *.* to '" + self.getUser() + "'@'%';");
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
});

@QuarkusApplication
static RestService app = new RestService().withProperties("mysql.properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.apache.http.HttpStatus;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Tag;
Expand Down Expand Up @@ -213,7 +212,6 @@ public void smokeTestMetricsNarayanaProgrammaticTransaction() {
@Order(8)
@Tag("QUARKUS-2739")
@Test
@Disabled("https://github.com/quarkus-qe/quarkus-test-suite/issues/1397")
public void testTransactionRecovery() {
// make it possible to disable transaction recovery tests for certain databases
testTransactionRecoveryInternal();
Expand Down

0 comments on commit 56c0792

Please sign in to comment.