Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMORO-3183] Add Ams On K8S TestContainer Unit Base Test (#3183) #3213

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
37 changes: 37 additions & 0 deletions amoro-ams/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,43 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

<!-- testcontainers dependencies -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.17.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.17.2</version>
<scope>test</scope>
</dependency>

<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just test use it

<groupId>io.kubernetes</groupId>
<artifactId>client-java</artifactId>
<version>15.0.1</version>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>k3s</artifactId>
<version>1.20.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<version>1.19.6</version>
<scope>test</scope>
</dependency>


</dependencies>

<build>
Expand Down
56 changes: 56 additions & 0 deletions amoro-ams/src/test/java/org/apache/amoro/server/AmoroAMSTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.amoro.server;

import static org.apache.amoro.server.AmoroServiceContainer.LOG;

import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

public class AmoroAMSTest {
@ClassRule public static final Network NETWORK = Network.newNetwork();

private static final String AMS_IMAGE_VERSION = "apache/amoro:master-snapshot";

public GenericContainer AMSContainer =
new GenericContainer(DockerImageName.parse(AMS_IMAGE_VERSION))
.withExposedPorts(1630, 1630)
.withCommand("ams")
.withNetwork(NETWORK)
.waitingFor(Wait.forHttp("/"));

@Test
public void testAMS() throws Exception {

LOG.info("Starting AMS standalone containers...");

AMSContainer.start();
AMSContainer.waitingFor(Wait.forLogMessage(".*Ready to accept connections.*\\n", 1));

Assert.assertTrue(AMSContainer.isRunning());
Wait.forHealthcheck();

LOG.info("Containers are started.");
}
}
Loading