Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
dcm: test case to exercise simple identifiers in non-constraint views
Browse files Browse the repository at this point in the history
Signed-off-by: Lalith Suresh <lsuresh@vmware.com>
  • Loading branch information
lalithsuresh committed Jul 24, 2021
1 parent 4a430c1 commit e465042
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dcm/src/test/java/com/vmware/dcm/ModelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,28 @@ public void testAnyConst() {
assertEquals(2, fetch.size());
}


@Test
public void testNonConstraintViews() {
final DSLContext conn = setup();
conn.execute("CREATE TABLE t1(c1 integer, controllable__c2 integer)");

final List<String> views = List.of("CREATE CONSTRAINT intermediate_view AS " +
"SELECT c1, controllable__c2 as c2 FROM t1",
"CREATE CONSTRAINT c_on_intermediate_view AS " +
"SELECT * FROM intermediate_view " +
"CHECK c1 = 10 and c2 = 11");

final Model model = buildModel(conn, SolverConfig.OrToolsSolver, views, "testAll");

conn.execute("insert into t1 values (10, 1)");
conn.execute("insert into t1 values (10, 2)");

final Result<? extends Record> fetch = model.solve("T1");
assertEquals(Set.of(10), fetch.intoSet(0));
assertEquals(Set.of(11), fetch.intoSet(1));
}

@Test
@Disabled("Enable when /~https://github.com/vmware/declarative-cluster-management/issues/112 is fixed")
public void testSolverTimeLimit() {
Expand Down

0 comments on commit e465042

Please sign in to comment.