Skip to content

Commit

Permalink
Add test of non-embedded links in asymmetric objects
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Sep 15, 2023
1 parent 04cd65f commit a3828f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions test/object-store/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,16 +410,17 @@ TEST_CASE("Schema") {
"Property 'object.link' of type 'object' cannot be a link to an asymmetric object."));
}

SECTION("rejects link properties with asymmetric origin object") {
SECTION("allow link properties with asymmetric origin object") {
Schema schema = {
{"object",
ObjectSchema::ObjectType::TopLevelAsymmetric,
{{"link", PropertyType::Object | PropertyType::Nullable, "link target"}}},
{"link target", {{"value", PropertyType::Int}}},
{{"_id", PropertyType::Int, Property::IsPrimary{true}},
{"link", PropertyType::Object | PropertyType::Nullable, "link target"}}},
{"link target",
{{"_id", PropertyType::Int, Property::IsPrimary{true}},
{"value", PropertyType::Int}}},
};
REQUIRE_EXCEPTION(schema.validate(SchemaValidationMode::SyncFLX), SchemaValidationFailed,
ContainsSubstring("Asymmetric table with property 'object.link' of type 'object' "
"cannot have a non-embedded object type."));
REQUIRE_NOTHROW(schema.validate(SchemaValidationMode::SyncFLX));
}

SECTION("allow embedded objects with asymmetric sync") {
Expand Down
4 changes: 2 additions & 2 deletions test/test_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5898,8 +5898,8 @@ TEST(Table_AsymmetricObjects)
tr = sg->start_write();
auto table2 = tr->add_table("target table");
table = tr->get_table("mytable");
// Outgoing link from asymmetric object is not allowed.
CHECK_THROW(table->add_column(*table2, "link"), LogicError);
// Outgoing link from asymmetric object is allowed.
CHECK_NOTHROW(table->add_column(*table2, "link"));
// Incoming link to asymmetric object is not allowed.
CHECK_THROW(table2->add_column(*table, "link"), LogicError);
tr->commit();
Expand Down

0 comments on commit a3828f4

Please sign in to comment.