Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance test logging output #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions rai-sdk/src/test/java/com/relationalai/DatabaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Database find(Database[] databases, String name) {
void testDatabase() throws HttpError, InterruptedException, IOException {
var client = createClient();

log.info("database: " + databaseName);

try {
client.deleteDatabase(databaseName);
} catch (HttpError e) {
Expand Down
2 changes: 2 additions & 0 deletions rai-sdk/src/test/java/com/relationalai/EngineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Engine find(Engine[] engines, String name) {
@Test void testEngine() throws HttpError, InterruptedException, IOException {
var client = createClient();

log.info("engine: " + engineName);

var engine = client.getEngine(engineName);
assertEquals(engine.name, engineName);
assertEquals(engine.state, "PROVISIONED");
Expand Down
2 changes: 2 additions & 0 deletions rai-sdk/src/test/java/com/relationalai/ExecuteAsyncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ void testExecuteAsync() throws HttpError, InterruptedException, IOException, URI

var rsp = client.execute(databaseName, engineName, query, true);

log.info("transaction id: " + rsp.transaction.id);

var results = new ArrayList<ArrowRelation> () {
{
add(new ArrowRelation("/:output/Int64/Int64/Int64/Int64", Arrays.asList(new Object[] {1L, 2L, 3L, 4L, 5L}) ));
Expand Down
2 changes: 2 additions & 0 deletions rai-sdk/src/test/java/com/relationalai/OAuthClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class OAuthClientTest extends UnitTest {
@Test void testOAuthClient() throws HttpError, InterruptedException, IOException {
var client = createClient();

log.info("client name: " + clientName);

var rsp = client.findOAuthClient(clientName);
if (rsp != null) {
client.deleteOAuthClient(rsp.id);
Expand Down
5 changes: 5 additions & 0 deletions rai-sdk/src/test/java/com/relationalai/UnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
import java.util.Map;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.logging.Logger;

public abstract class UnitTest {
static UUID uuid = UUID.randomUUID();
static String databaseName = String.format("java-sdk-test-%s", uuid);
static String engineName = String.format("java-sdk-test-%s", uuid);

static final Logger log = Logger.getLogger(UnitTest.class.getName());

static Config getConfig() throws IOException {
var filename = String.format("%s/.rai/config", System.getenv("HOME"));
if ((new File(filename)).exists()) {
Expand All @@ -49,6 +52,7 @@ static Client createClient() throws IOException {
var cfg = getConfig();
var customHeaders = (Map<String, String>) Json.deserialize(getenv("CUSTOM_HEADERS", "{}"), Map.class);

log.info("custom headers: " + Json.serialize(customHeaders));
var testClient = new Client(cfg);
var httpHeaders = testClient.getDefaultHttpHeaders();
for (var header : customHeaders.entrySet()) {
Expand All @@ -59,6 +63,7 @@ static Client createClient() throws IOException {

// Ensure that the test database exists.
void ensureDatabase() throws HttpError, InterruptedException, IOException {
log.info(String.format("engine: %s, database: %s", engineName, databaseName));
ensureDatabase(createClient());
}

Expand Down
2 changes: 2 additions & 0 deletions rai-sdk/src/test/java/com/relationalai/UserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class UserTest extends UnitTest {
void testUser() throws HttpError, InterruptedException, IOException {
var client = createClient();

log.info("user email: " + userEmail);

var rsp = client.findUser(userEmail);
if (rsp != null) {
client.deleteUser(rsp.id);
Expand Down