korlov42 commented on a change in pull request #542: URL: https://github.com/apache/ignite-3/pull/542#discussion_r790478345
########## File path: modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItTableCreationTest.java ########## @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.sql.engine; + +import static org.apache.ignite.internal.sql.engine.util.CursorUtils.getAllFromCursor; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; +import org.apache.ignite.internal.app.IgniteImpl; +import org.apache.ignite.internal.test.WatchListenerInhibitor; +import org.junit.jupiter.api.Test; + +/** + * Table creation visibility tests. + */ +public class ItTableCreationTest extends AbstractBasicIntegrationTest { + /** + * Schema name. + */ + public static final String SCHEMA = "PUBLIC"; + + /** {@inheritDoc} */ + @Override + protected int nodes() { + return 3; + } + + /** Test sql correctness with lagged node. */ + @Test + public void testTableOperationsWithLaggedNode() throws Exception { Review comment: do we really need such test? I've commented out the crucial part of schema synchronisation, and this test still passes. ########## File path: modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/externalize/RelJsonReaderTest.java ########## @@ -71,5 +77,49 @@ void fromJson() { assertThat(node.getTable(), notNullValue()); assertThat(node.getTable().unwrap(IgniteTable.class), is(igniteTableMock)); Mockito.verify(schemaMock).tableById(tableId); + + AtomicBoolean tableByIdCalled = new AtomicBoolean(); + RelJsonReader reader = new RelJsonReader(schemaMock); + + when(schemaMock.tableById(any())).thenAnswer((k) -> { + tableByIdCalled.set(true); + + return igniteTableMock; + }); + + reader.read(json); + assertTrue(tableByIdCalled.get()); + } + + /** + * Checks that appropriate methods called form table manager on rel node construction. + */ + @Test + void checkTableManagerCalled() throws Exception { Review comment: This doesn't look right, because we use JsonReader to validate behaviour of SqlSchemaManager. Let's move this test to distinct class and remove all deserialisation related code ########## File path: modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/externalize/RelJsonReaderTest.java ########## @@ -71,5 +77,49 @@ void fromJson() { assertThat(node.getTable(), notNullValue()); assertThat(node.getTable().unwrap(IgniteTable.class), is(igniteTableMock)); Mockito.verify(schemaMock).tableById(tableId); + + AtomicBoolean tableByIdCalled = new AtomicBoolean(); + RelJsonReader reader = new RelJsonReader(schemaMock); + + when(schemaMock.tableById(any())).thenAnswer((k) -> { + tableByIdCalled.set(true); + + return igniteTableMock; + }); + + reader.read(json); + assertTrue(tableByIdCalled.get()); Review comment: this is already validated by group of assertions above -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
