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

Test datetime attribute insert and match time-zone invariant #424

Merged
merged 9 commits into from
Jul 3, 2023
2 changes: 1 addition & 1 deletion dependencies/vaticle/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def vaticle_typedb_behaviour():
git_repository(
name = "vaticle_typedb_behaviour",
remote = "https://github.com/vaticle/typedb-behaviour",
commit = "767bf98fef7383addf42a1ae6e97a44874bb4f0b" # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_typedb_behaviour
commit = "90b4addcd71a398e9e52e322021c49310e66a47a" # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_typedb_behaviour
)

def vaticle_factory_tracing():
Expand Down
1 change: 1 addition & 0 deletions test/behaviour/concept/thing/attribute/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ typedb_behaviour_java_test(
"//test/behaviour/connection/database:steps",
"//test/behaviour/connection/session:steps",
"//test/behaviour/connection/transaction:steps",
"//test/behaviour/util:steps"
],
deps = [
# Internal Package Dependencies
Expand Down
6 changes: 3 additions & 3 deletions test/behaviour/typeql/TypeQLSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,13 +645,13 @@ public boolean check(Concept concept) {
}
}

public static class AttributeUniquenessCheck {
public static abstract class AttributeUniquenessCheck {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!


protected final Label type;
protected final String value;

AttributeUniquenessCheck(String typeAndValue) {
String[] s = typeAndValue.split(":");
String[] s = typeAndValue.split(":", 2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of this but I think we'll take it for now. Thoughts: it's not obvious how this is going to interplace with the next assertion line, and what it means about the format of the 'typeAndValue' identifier we're expecting (less explainable in 1 short sentence IMO)

assertEquals(
String.format("A check for attribute uniqueness should be given in the format \"type:value\", but received %s.", typeAndValue),
2, s.length
Expand Down Expand Up @@ -745,7 +745,7 @@ public static class ValueUniquenessCheck implements UniquenessCheck {
private final String value;

ValueUniquenessCheck(String valueTypeAndValue) {
String[] s = valueTypeAndValue.split(":");
String[] s = valueTypeAndValue.split(":", 2);
this.valueType = s[0].toLowerCase().strip();
this.value = s[1].strip();
}
Expand Down
1 change: 1 addition & 0 deletions test/behaviour/typeql/language/insert/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ typedb_behaviour_java_test(
connection_steps_core = "//test/behaviour/connection:steps-core",
connection_steps_cluster = "//test/behaviour/connection:steps-cluster",
steps = [
"//test/behaviour/util:steps",
"//test/behaviour/typeql:steps",
"//test/behaviour/connection/session:steps",
],
Expand Down
8 changes: 8 additions & 0 deletions test/behaviour/util/UtilSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@
package com.vaticle.typedb.client.test.behaviour.util;

import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;

import java.util.TimeZone;

public class UtilSteps {

@When("set time-zone is: {word}")
public void set_timezone(String value){
TimeZone.setDefault(TimeZone.getTimeZone(value));
}

shiladitya-mukherjee marked this conversation as resolved.
Show resolved Hide resolved
@Then("wait {int} seconds")
public void wait_seconds(int seconds) throws InterruptedException {
Thread.sleep(seconds * 1000L);
Expand Down