rdblue commented on a change in pull request #1587: URL: https://github.com/apache/iceberg/pull/1587#discussion_r520906352
########## File path: nessie/src/test/java/org/apache/iceberg/nessie/TestCatalog.java ########## @@ -0,0 +1,53 @@ +/* + * 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.iceberg.nessie; + +import java.util.List; +import org.apache.iceberg.catalog.Namespace; +import org.apache.iceberg.catalog.TableIdentifier; +import org.junit.Assert; +import org.junit.Test; + +public class TestCatalog extends BaseTestIceberg { + + private static final String BRANCH = "test-catalog-branch"; + + public TestCatalog() { + super(BRANCH); + } + + @Test + public void test() { + createTable(TableIdentifier.of("foo", "bar")); + List<TableIdentifier> tables = catalog.listTables(Namespace.of("foo")); + Assert.assertEquals(1, tables.size()); + Assert.assertEquals("bar", tables.get(0).name()); + Assert.assertEquals("foo", tables.get(0).namespace().toString()); + catalog.renameTable(TableIdentifier.of("foo", "bar"), TableIdentifier.of("foo", "baz")); + tables = catalog.listTables(null); + Assert.assertEquals(1, tables.size()); + Assert.assertEquals("baz", tables.get(0).name()); + Assert.assertEquals("foo", tables.get(0).namespace().toString()); + catalog.dropTable(TableIdentifier.of("foo", "baz")); + tables = catalog.listTables(Namespace.empty()); + Assert.assertTrue(tables.isEmpty()); Review comment: I prefer to separate tests into distinct cases. It looks like this combines `testRename` with `testListTables`. Combining test cases into a single method causes failures to prevent other tests from running, which makes the whole suite harder to work with. It is also a lot easier to spot missing test cases and add new ones when tests are separate. I'd recommend taking a look at most of these test suites. That said, I think that you'll be the primary reviewers here so in the end it is mostly up to you what conventions you want to maintain. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
