8000 [#1407] Upgrade Cockroach DB to 22.1.9 · hibernate/hibernate-reactive@a9b0790 · GitHub
[go: up one dir, main page]

< 8000 div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
Skip to content

Commit a9b0790

Browse files
blafondDavideD
authored andcommitted
[#1407] Upgrade Cockroach DB to 22.1.9
Signed-off-by: blafond <blafond@redhat.com>
1 parent 756204b commit a9b0790

File tree

6 files changed

+16
-26
lines changed

6 files changed

+16
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Hibernate Reactive has been tested with:
3434
- MySQL 8
3535
- MariaDB 10
3636
- Db2 11.5
37-
- CockroachDB 21.2
37+
- CockroachDB 22.1
3838
- MS SQL Server 2019
3939
- Oracle 21.3
4040
- [Hibernate ORM][] 5.6.12.Final Jarkarta EE edition

hibernate-reactive-core/src/test/java/org/hibernate/reactive/containers/CockroachDBDatabase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CockroachDBDatabase extends PostgreSQLDatabase {
2525
* TIP: To reuse the same containers across multiple runs, set `testcontainers.reuse.enable=true` in a file located
2626
* at `$HOME/.testcontainers.properties` (create the file if it does not exist).
2727
*/
28-
public static final CockroachContainer cockroachDb = new CockroachContainer( imageName( "cockroachdb/cockroach", "v21.2.14" ) )
28+
public static final CockroachContainer cockroachDb = new CockroachContainer( imageName( "cockroachdb/cockroach", "v22.1.9" ) )
2929
// Username, password and database are not supported by test container at the moment
3030
// Testcontainers will use a database named 'postgres' and the 'root' user
3131
.withReuse( true );

hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateCockroachDBTestBase.java

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.junit.Test;
3232

3333
import io.vertx.ext.unit.TestContext;
34+
import org.assertj.core.api.Assertions;
3435

3536
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
3637
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.GROUPED;
@@ -103,6 +104,8 @@ public void testValidationSucceed(TestContext context) {
103104

104105
@Test
105106
public void testUpdate(TestContext context) {
107+
// this test checks that the correct indexes and foreign constraints have been created
108+
// by looking at the content of the pg_catalog schema using the following native queries.
106109
final String indexDefinitionQuery =
107110
"select indexdef from pg_indexes where schemaname = 'public' and tablename = ? order by indexname";
108111

@@ -154,31 +157,19 @@ public void testUpdate(TestContext context) {
154157
.thenCompose( v -> s.createNativeQuery( indexDefinitionQuery, String.class )
155158
.setParameter( 1, "asimple" )
156159
.getResultList()
157-
.thenAccept( list -> {
158-
context.assertEquals(
159-
"CREATE INDEX i_asimple_avalue_astringvalue ON postgres.public.asimple USING btree (avalue ASC, astringvalue DESC)",
160-
list.get( 0 )
161-
);
162-
context.assertEquals(
163-
"CREATE INDEX i_asimple_avalue_data ON postgres.public.asimple USING btree (avalue DESC, data ASC)",
164-
list.get( 1 )
165-
);
166-
context.assertEquals(
167-
"CREATE UNIQUE INDEX \"primary\" ON postgres.public.asimple USING btree (id ASC)",
168-
list.get( 2 )
169-
);
170-
context.assertEquals(
171-
"CREATE UNIQUE INDEX u_asimple_astringvalue ON postgres.public.asimple USING btree (astringvalue ASC)",
172-
list.get( 3 )
173-
);
174-
} )
160+
.thenAccept( list -> Assertions.assertThat( list ).containsExactlyInAnyOrder(
161+
"CREATE INDEX i_asimple_avalue_astringvalue ON postgres.public.asimple USING btree (avalue ASC, astringvalue DESC)",
162+
"CREATE INDEX i_asimple_avalue_data ON postgres.public.asimple USING btree (avalue DESC, data ASC)",
163+
"CREATE UNIQUE INDEX asimple_pkey ON postgres.public.asimple USING btree (id ASC)",
164+
"CREATE UNIQUE INDEX u_asimple_astringvalue ON postgres.public.asimple USING btree (astringvalue ASC)"
165+
) )
175166
)
176167
.thenCompose( v -> s.createNativeQuery( indexDefinitionQuery, String.class )
177168
.setParameter( 1, "aother" )
178169
.getSingleResult()
179170
.thenAccept( result ->
180171
context.assertEquals(
181-
"CREATE UNIQUE INDEX \"primary\" ON postgres.public.aother USING btree (id1 ASC, id2 ASC)",
172+
"CREATE UNIQUE INDEX aother_pkey ON postgres.public.aother USING btree (id1 ASC, id2 ASC)",
182173
result
183174
)
184175
)
@@ -188,12 +179,11 @@ public void testUpdate(TestContext context) {
188179
.getSingleResult()
189180
.thenAccept( result ->
190181
context.assertEquals(
191-
"CREATE UNIQUE INDEX \"primary\" ON postgres.public.aanother USING btree (id ASC)",
182+
"CREATE UNIQUE INDEX aanother_pkey ON postgres.public.aanother USING btree (id ASC)",
192183
result
193184
)
194185
)
195186
)
196-
// check foreign keys
197187
.thenCompose( v -> s.createNativeQuery(
198188
foreignKeyDefinitionQuery,
199189
String.class

podman.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ configured to run the tests:
120120
```
121121
podman run --rm --name=HibernateTestingCockroachDB \
122122
--hostname=roachrr1 -p 26257:26257 -p 8080:8080 \
123-
cockroachdb/cockroach:v21.2.4 start-single-node --insecure
123+
cockroachdb/cockroach:v22.1.9 start-single-node --insecure
124124
```
125125

126126
Some of tests needs temporary tables and because this is an experimental feature in

tooling/jbang/CockroachDBReactiveTest.java.qute

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class {baseName} {
7070
}
7171

7272
@ClassRule
73-
public final static CockroachContainer database = new CockroachContainer( imageName( "cockroachdb", "cockroach", "v21.2.4" ) );
73+
public final static CockroachContainer database = new CockroachContainer( imageName( "cockroachdb", "cockroach", "v22.1.9" ) );
7474

7575
private Mutiny.SessionFactory sessionFactory;
7676

tooling/jbang/ReactiveTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ enum Database {
232232
MYSQL( () -> new MySQLContainer( "mysql:8.0.31" ) ),
233233
DB2( () -> new Db2Container( "docker.io/ibmcom/db2:11.5.7.0a" ).acceptLicense() ),
234234
MARIADB( () -> new MariaDBContainer( "mariadb:10.9.3" ) ),
538C
235-
COCKROACHDB( () -> new CockroachContainer( "cockroachdb/cockroach:v21.2.4" ) );
235+
COCKROACHDB( () -> new CockroachContainer( "cockroachdb/cockroach:v22.1.9" ) );
236236

237237
private final Supplier<JdbcDatabaseContainer<?>> containerSupplier;
238238

0 commit comments

Comments
 (0)
0