Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Some test resources are copied or mounted into Linux containers
# (database init scripts, TLS material, etc. used by Testcontainers rules).
# These files must always be checked out with LF line endings, otherwise
# containers fail on Windows working copies (e.g. "/bin/sh^M: bad interpreter").

# Shell scripts executed inside Linux containers
*.sh text eol=lf

# SQL and configuration files mounted into database containers
*.sql text eol=lf
*.conf text eol=lf
*.cnf text eol=lf
*.ini text eol=lf

# Certificate and key material must never be rewritten
*.crt -text
*.key -text
*.pem -text
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public class DB2Resource extends ExternalResource {
private final GenericContainer instance = new GenericContainer<>("icr.io/db2_community/db2:" + CONTAINER_VERSION)
.withCreateContainerCmdModifier(cmd -> cmd
.withCapAdd(Capability.IPC_LOCK)
.withCapAdd(Capability.IPC_OWNER))
.withCapAdd(Capability.IPC_OWNER)
// Podman mounts container volumes with nosuid, which prevents the DB2 setuid
// binaries (db2start & friends) from running: the entrypoint fails with SQL1641N,
// surfaced as SQL1042C. Privileged mode mounts /database without nosuid.
.withPrivileged(true))
.withEnv("LICENSE", "accept")
.withEnv("DB2INSTANCE", "vertx")
.withEnv("DB2INST1_PASSWORD", "vertx")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

package io.vertx.tests.mysqlclient;

import io.netty.util.internal.PlatformDependent;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.file.FileSystem;
Expand All @@ -32,6 +33,8 @@
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static org.junit.Assume.assumeFalse;

@RunWith(VertxUnitRunner.class)
public class MySQLQueryTest extends MySQLTestBase {

Expand Down Expand Up @@ -308,6 +311,8 @@ public void testEncodePacketSizeMoreThan16MB(TestContext ctx) {

@Test
public void testLocalInfileRequest(TestContext ctx) {
assumeFalse(PlatformDependent.isWindows());

FileSystem fileSystem = vertx.fileSystem();
Buffer fileData = Buffer.buffer();
for (int i = 0; i < 10000; i++) {
Expand Down Expand Up @@ -373,6 +378,8 @@ public void testLocalInfileRequest(TestContext ctx) {

@Test
public void testLocalInfileRequestEmptyFile(TestContext ctx) {
assumeFalse(PlatformDependent.isWindows());

FileSystem fileSystem = vertx.fileSystem();
Buffer fileData = Buffer.buffer();
fileSystem
Expand Down Expand Up @@ -406,6 +413,8 @@ public void testLocalInfileRequestEmptyFile(TestContext ctx) {

@Test
public void testLocalInfileRequestInPackets(TestContext ctx) {
assumeFalse(PlatformDependent.isWindows());

FileSystem fileSystem = vertx.fileSystem();
Buffer fileData = Buffer.buffer();
for (int i = 0; i < 200000; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package io.vertx.tests.mysqlclient.junit;

import com.github.dockerjava.api.model.Ulimit;
import io.netty.util.internal.PlatformDependent;
import io.vertx.mysqlclient.MySQLConnectOptions;
import io.vertx.mysqlclient.SslMode;
import org.junit.rules.ExternalResource;
Expand Down Expand Up @@ -96,13 +97,14 @@ private void initServer() throws IOException {
server.withExposedPorts(DEFAULT_PORT);
}


mysqldDir = Files.createTempDirectory("mysqld").toFile();
mysqldDir.deleteOnExit();
mysqldDir.setReadable(true, false);
mysqldDir.setWritable(true, false);
mysqldDir.setExecutable(true, false);
server.withFileSystemBind(mysqldDir.getAbsolutePath(), "/var/run/mysqld");
if (!PlatformDependent.isWindows()) {
mysqldDir = Files.createTempDirectory("mysqld").toFile();
mysqldDir.deleteOnExit();
mysqldDir.setReadable(true, false);
mysqldDir.setWritable(true, false);
mysqldDir.setExecutable(true, false);
server.withFileSystemBind(mysqldDir.getAbsolutePath(), "/var/run/mysqld");
}

if (ssl) {
server.withClasspathResourceMapping("tls/conf", "/etc/mysql/conf.d", BindMode.READ_ONLY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public abstract class OracleGeneratedKeysTestBase extends OracleTestBase {
" localDateTime TIMESTAMP DEFAULT timestamp '2018-11-04 00:00:00' NOT NULL,\n" +
" inte NUMBER(10) DEFAULT 42 NOT NULL,\n" +
" longe NUMBER(19) DEFAULT 84 NOT NULL,\n" +
" floate BINARY_FLOAT DEFAULT '42.42' NOT NULL,\n" +
" doublee BINARY_DOUBLE DEFAULT '84.84' NOT NULL,\n" +
" bigDecimal NUMBER(3, 1) DEFAULT '4.2' NOT NULL,\n" +
" floate BINARY_FLOAT DEFAULT 42.42 NOT NULL,\n" +
" doublee BINARY_DOUBLE DEFAULT 84.84 NOT NULL,\n" +
" bigDecimal NUMBER(3, 1) DEFAULT 4.2 NOT NULL,\n" +
" offsetDateTime TIMESTAMP WITH TIME ZONE DEFAULT timestamp '2019-11-04 00:00:00 +01:02' NOT NULL,\n" +
" PRIMARY KEY (id)\n" +
")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package io.vertx.tests.pgclient;

import io.netty.util.internal.PlatformDependent;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.pgclient.PgConnection;
Expand All @@ -28,6 +29,7 @@

import java.util.ArrayList;
import java.util.List;
import static org.junit.Assume.assumeFalse;

/**
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
Expand Down Expand Up @@ -84,6 +86,9 @@ public void testBatchUpdate(TestContext ctx) {

@Test
public void testQueueQueries(TestContext ctx) {
// Skipped on Windows: the podman/WSL2 port-forwarding proxy tears the connection on the
// TCP half-close sent by PgEncoder after Terminate, losing in-flight server responses
assumeFalse(PlatformDependent.isWindows());
int num = 1000;
Async async = ctx.async(num + 1);
connector.accept(ctx.asyncAssertSuccess(conn -> {
Expand Down Expand Up @@ -111,6 +116,9 @@ public void testQueueQueries(TestContext ctx) {

@Test
public void testCancelRequest(TestContext ctx) {
// Skipped on Windows: the podman/WSL2 port-forwarding proxy tears the connection on the
// TCP half-close sent by PgEncoder after Terminate, losing in-flight server responses
assumeFalse(PlatformDependent.isWindows());
Async async = ctx.async(2);
connector.accept(ctx.asyncAssertSuccess(conn -> {
conn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

package io.vertx.tests.pgclient.tck;

import io.netty.util.internal.PlatformDependent;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import io.vertx.sqlclient.spi.DatabaseMetadata;
Expand All @@ -19,6 +20,8 @@
import org.junit.ClassRule;
import org.junit.runner.RunWith;

import static org.junit.Assume.assumeFalse;

@RunWith(VertxUnitRunner.class)
public class PgConnectionTest extends ConnectionTestBase {
@ClassRule
Expand All @@ -37,6 +40,22 @@ public void tearDown(TestContext ctx) {
super.tearDown(ctx);
}

@Override
public void testCloseWithQueryInProgress(TestContext ctx) {
// Skipped on Windows: the podman/WSL2 port-forwarding proxy tears the connection on the
// TCP half-close sent by PgEncoder after Terminate, losing in-flight server responses
assumeFalse(PlatformDependent.isWindows());
super.testCloseWithQueryInProgress(ctx);
}

@Override
public void testCloseWithErrorInProgress(TestContext ctx) {
// Skipped on Windows: the podman/WSL2 port-forwarding proxy tears the connection on the
// TCP half-close sent by PgEncoder after Terminate, losing in-flight server responses
assumeFalse(PlatformDependent.isWindows());
super.testCloseWithErrorInProgress(ctx);
}

@Override
protected void validateDatabaseMetaData(TestContext ctx, DatabaseMetadata md) {
ctx.assertTrue(md.majorVersion() >= 9);
Expand Down
1 change: 1 addition & 0 deletions vertx-pg-client/src/test/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
open module io.vertx.tests.sql.client.pg {

requires io.netty.common;
requires io.netty.buffer;
requires io.netty.transport;
requires com.ongres.scram.client;
Expand Down
Loading