nastra commented on code in PR #7144:
URL: https://github.com/apache/iceberg/pull/7144#discussion_r1147175520
##########
api/src/test/java/org/apache/iceberg/TestHelpers.java:
##########
@@ -137,6 +142,18 @@ public static void assertSerializedAndLoadedMetadata(Table
expected, Table actua
Assert.assertEquals("History must match", expected.history(),
actual.history());
}
+ public static void assertSerializedMetricsReporter(
Review Comment:
no need to add this here, this can be just part of the test method itself
##########
api/src/test/java/org/apache/iceberg/TestHelpers.java:
##########
@@ -137,6 +142,18 @@ public static void assertSerializedAndLoadedMetadata(Table
expected, Table actua
Assert.assertEquals("History must match", expected.history(),
actual.history());
}
+ public static void assertSerializedMetricsReporter(
+ MetricsReporter expected, MetricsReporter actual) {
+ Assert.assertNotNull("metrics reporter from serializableTable should not
be null", actual);
+ Assert.assertTrue(
+ "metrics reporter from serializableTable should be instance of
TestMetricsReporter",
+ actual instanceof TestMetricsReporter);
+ Assert.assertEquals(
+ "metrics reporter from serializableTable should equals the one from
origin table",
+ expected,
+ actual);
Review Comment:
rather than testing actual equality on the objects, it should be enough to
make sure that the properties are the same, hence the `TestMetricsReporter`
wouldn't need to implement hasCode/equals
##########
api/src/test/java/org/apache/iceberg/TestHelpers.java:
##########
@@ -137,6 +142,18 @@ public static void assertSerializedAndLoadedMetadata(Table
expected, Table actua
Assert.assertEquals("History must match", expected.history(),
actual.history());
}
+ public static void assertSerializedMetricsReporter(
+ MetricsReporter expected, MetricsReporter actual) {
+ Assert.assertNotNull("metrics reporter from serializableTable should not
be null", actual);
+ Assert.assertTrue(
Review Comment:
this can be simplified to
`Assertions.assertThat(actual).isNotNull().isInstanceOf(...)` and for the
properties: `Assertions.assertThat(actual.properties).isEqualTo(...)`
##########
core/src/test/java/org/apache/iceberg/TestTables.java:
##########
@@ -264,8 +265,17 @@ public void commit(TableMetadata base, TableMetadata
updatedMetadata) {
throw new CommitFailedException("Injected failure");
}
Integer version = VERSIONS.get(tableName);
+ String metadataLocation =
Review Comment:
why are these changes necessary?
##########
core/src/test/java/org/apache/iceberg/TestSerializableTable.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+import static org.apache.iceberg.TestHelpers.assertSerializedMetricsReporter;
+import static org.apache.iceberg.TestHelpers.roundTripSerialize;
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+import java.io.IOException;
+import java.util.Map;
+import org.apache.iceberg.metrics.MetricsReporter;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
+import org.apache.iceberg.types.Types;
+import org.junit.After;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
Review Comment:
please take a look at https://iceberg.apache.org/contribute/#testing.
Basically new test classes should be JUnit5 rather than JUnit4
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]