Skip to content

Commit

Permalink
cicd: Added early-access and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jruaux committed Jun 17, 2024
1 parent dace70e commit 9689c0e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
39 changes: 39 additions & 0 deletions plugins/riot/src/test/java/com/redis/riot/PostgresDeltaTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.redis.riot;

import java.io.IOException;
import java.sql.SQLException;
import java.sql.Statement;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.utility.DockerImageName;

class PostgresDeltaTests extends DbTests {

private static final DockerImageName postgresImage = DockerImageName.parse(PostgreSQLContainer.IMAGE)
.withTag(PostgreSQLContainer.DEFAULT_TAG);
private static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>(postgresImage);

@Override
protected JdbcDatabaseContainer<?> getJdbcDatabaseContainer() {
return postgres;
}

@BeforeAll
void setupPostgres() throws SQLException, IOException {
executeScript("db/postgres-delta.sql");
}

@Test
void importDelta(TestInfo info) throws Exception {
try (Statement statement = dbConnection.createStatement()) {
for (int index = 0; index < 10; index++) {
statement.execute("INSERT INTO orders (order_date) VALUES (CURRENT_TIMESTAMP - INTERVAL '5 seconds')");
}
}
}

}
7 changes: 7 additions & 0 deletions plugins/riot/src/test/resources/db/postgres-delta.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DROP TABLE IF EXISTS orders;

CREATE TABLE orders (
order_id SERIAL PRIMARY KEY,
order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

0 comments on commit 9689c0e

Please sign in to comment.