fmorillo7694 commented on code in PR #206: URL: https://github.com/apache/flink-connector-aws/pull/206#discussion_r4172321356
########## flink-catalog-aws/flink-catalog-aws-glue/archunit-violations/stored.rules: ########## @@ -0,0 +1,4 @@ +# +#Thu Aug 11 14:04:41 CEST 2022 Review Comment: This is the standard flink-architecture-tests wiring that every other module in this repo carries (compare flink-connector-kinesis or flink-connector-dynamodb). The ArchUnit rules run on every build and store known violations in archunit-violations/stored.rules; the file is empty here because the module has none, and it must exist for the rules to run at all. Abhi asked for the module to be brought in line with its siblings in his previous round, and wiring it immediately caught two ITCases that were missing a MiniClusterExtension, so it has already paid for itself. ########## flink-catalog-aws/flink-catalog-aws-glue/src/test/resources/archunit.properties: ########## @@ -0,0 +1,31 @@ +# +# 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. +# + +# By default we allow removing existing violations, but fail when new violations are added. +freeze.store.default.allowStoreUpdate=true Review Comment: Same reason as stored.rules: archunit.properties is the per-module ArchUnit configuration every sibling module has (it points at the violation store and enables freezing). Without it the flink-architecture-tests-test dependency is inert. ########## flink-catalog-aws/flink-catalog-aws-glue/src/test/java/org/apache/flink/table/catalog/glue/GlueCatalogSqlMotoITCase.java: ########## @@ -0,0 +1,254 @@ +/* + * 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.flink.table.catalog.glue; + +import org.apache.flink.table.api.EnvironmentSettings; +import org.apache.flink.table.api.TableEnvironment; +import org.apache.flink.test.junit5.MiniClusterExtension; +import org.apache.flink.types.Row; +import org.apache.flink.util.CollectionUtil; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.glue.GlueClient; +import software.amazon.awssdk.services.glue.model.Table; + +import java.net.URI; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.tuple; + +/** + * SQL-path integration test for the Glue catalog against a moto Glue emulator. + * + * <p>Unlike {@link GlueCatalogMotoITCase}, which drives {@link GlueCatalog} methods directly, this + * test exercises the full user path: {@code CREATE CATALOG ... WITH ('type'='glue')} discovers + * {@code GlueCatalogFactory} via SPI, the factory builds its own {@code GlueClient}, and all + * catalog operations flow through Flink SQL DDL and the planner down to the Glue wire protocol. + * + * <p>The factory-built client is pointed at moto through the catalog's {@code aws.endpoint} option + * (handled by the shared AWS client-creation path) and system-property credentials, so this test + * also covers the factory's AWS option pass-through. + */ +@Testcontainers +@ExtendWith(MiniClusterExtension.class) +class GlueCatalogSqlMotoITCase { + + private static final int MOTO_PORT = 5000; + + @Container + private static final GenericContainer<?> MOTO = Review Comment: Moto is the open source AWS emulator (github.com/getmoto/moto). Its server mode speaks the real Glue wire protocol, so these ITCases exercise the actual SDK client and the catalog's request building against a Glue that runs in a Docker container, with no credentials and no account. Nothing in the main code depends on it; it is a test scoped Testcontainers image only, in the same way flink-connector-kinesis and the GSR tests use Localstack. It does not replace the real Glue end to end suite (GlueCatalogEndToEndITCase and friends run against a real account when credentials are present and have caught things moto cannot, for example Glue refusing CreatePartition on a table without a location). Moto covers the wire level every build; real Glue covers the semantics moto does not emulate. -- 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]
