Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CONJ-997] correcting use of galeraAllowedState
test addition
- Loading branch information
Showing
4 changed files
with
57 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/test/java/org/mariadb/jdbc/integration/GaleraTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: LGPL-2.1-or-later | ||
// Copyright (c) 2012-2014 Monty Program Ab | ||
// Copyright (c) 2015-2021 MariaDB Corporation Ab | ||
|
||
package org.mariadb.jdbc.integration; | ||
|
||
import java.sql.SQLException; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.mariadb.jdbc.Connection; | ||
|
||
public class GaleraTest extends Common { | ||
|
||
@Test | ||
public void galeraAllowedStatesTest() throws SQLException { | ||
if ("galera".equals(System.getenv("srv"))) { | ||
try (Connection con = createCon("galeraAllowedState=4,5,6")) { | ||
con.isValid(1); | ||
} | ||
} else { | ||
try { | ||
createCon("galeraAllowedState=4,5,6"); | ||
Assertions.fail(); | ||
} catch (SQLException e) { | ||
Assertions.assertTrue(e.getMessage().contains("Initialization command fail")); | ||
Assertions.assertTrue( | ||
e.getCause() | ||
.getMessage() | ||
.contains("fail to validate Galera state (unknown 'wsrep_local_state' state)")); | ||
} | ||
} | ||
} | ||
} |