Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
outputs:
basic-checks: ${{ steps.selective-checks.outputs.basic-checks }}
needs-basic-checks: ${{ steps.selective-checks.outputs.needs-basic-checks }}
needs-build: ${{ steps.selective-checks.outputs.needs-build }}
needs-compile: ${{ steps.selective-checks.outputs.needs-compile }}
needs-compose-tests: ${{ steps.selective-checks.outputs.needs-compose-tests }}
needs-dependency-check: ${{ steps.selective-checks.outputs.needs-dependency-check }}
basic-checks: false
needs-basic-checks: false
needs-build: false
needs-compile: false
needs-compose-tests: false
needs-dependency-check: false
needs-integration-tests: ${{ steps.selective-checks.outputs.needs-integration-tests }}
needs-kubernetes-tests: ${{ steps.selective-checks.outputs.needs-kubernetes-tests }}
needs-kubernetes-tests: false
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
Expand Down Expand Up @@ -322,13 +322,16 @@ jobs:
strategy:
matrix:
profile:
- client
- filesystem
- hdds
- om
- ozone
- scm
- flaky
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
fail-fast: false
steps:
- name: Checkout project
Expand All @@ -348,11 +351,9 @@ jobs:
distribution: 'temurin'
java-version: 8
- name: Execute tests
run: hadoop-ozone/dev-support/checks/integration.sh -P${{ matrix.profile }}
if: matrix.profile != 'flaky'
- name: Execute flaky tests
run: hadoop-ozone/dev-support/checks/integration.sh -P${{ matrix.profile }} -Dsurefire.rerunFailingTestsCount=5 -Dsurefire.fork.timeout=3600
if: matrix.profile == 'flaky'
run: hadoop-ozone/dev-support/checks/integration.sh -Dtest=TestOzoneContainerWithTLS
env:
ITERATIONS: 10
- name: Summary of failures
run: cat target/${{ github.job }}/summary.txt
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token;
import org.apache.ozone.test.GenericTestUtils;
import org.apache.ozone.test.TestClock;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand All @@ -59,6 +60,10 @@
import java.nio.file.Path;
import java.security.cert.CertificateExpiredException;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -99,7 +104,7 @@ public class TestOzoneContainerWithTLS {
private ContainerTokenSecretManager secretManager;
private CertificateClientTestImpl caClient;
private boolean containerTokenEnabled;
private int certLifetime = 10 * 1000; // 10s
private int certLifetime = 15 * 1000; // 15s

public TestOzoneContainerWithTLS(boolean enableToken) {
this.containerTokenEnabled = enableToken;
Expand Down Expand Up @@ -152,12 +157,13 @@ public void setup() throws Exception {
@Test(expected = CertificateExpiredException.class)
public void testCertificateLifetime() throws Exception {
// Sleep to wait for certificate expire
Thread.sleep(certLifetime);
caClient.getCertificate().checkValidity();
LocalDateTime now = LocalDateTime.now();
now = now.plusSeconds(certLifetime / 1000);
caClient.getCertificate().checkValidity(Date.from(
now.atZone(ZoneId.systemDefault()).toInstant()));
}

@Test
@org.junit.Ignore("HDDS-7628")
public void testCreateOzoneContainer() throws Exception {
LOG.info("testCreateOzoneContainer with TLS and containerToken enabled: {}",
containerTokenEnabled);
Expand Down Expand Up @@ -203,7 +209,6 @@ public void testCreateOzoneContainer() throws Exception {
}

@Test
@org.junit.Ignore("HDDS-7628")
public void testContainerDownload() throws Exception {
DatanodeDetails dn = MockDatanodeDetails.createDatanodeDetails(
UUID.randomUUID().toString(), "localhost", "0.0.0.0",
Expand All @@ -228,29 +233,26 @@ public void testContainerDownload() throws Exception {

// Create containers
long containerId = ContainerTestHelper.getTestContainerID();
int count = 5;
List<Long> containerIdList = new ArrayList<>();
XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf,
Collections.singletonList(caClient.getCACertificate()));
client.connect();
for (int i = 0; i < count; i++, containerId++) {
if (containerTokenEnabled) {
Token<ContainerTokenIdentifier> token = secretManager.generateToken(
UserGroupInformation.getCurrentUser().getUserName(),
ContainerID.valueOf(containerId));
createSecureContainer(client, containerId, token);
closeSecureContainer(client, containerId, token);
} else {
createContainer(client, containerId);
closeContainer(client, containerId);
}
containerIdList.add(containerId);
if (containerTokenEnabled) {
Token<ContainerTokenIdentifier> token = secretManager.generateToken(
UserGroupInformation.getCurrentUser().getUserName(),
ContainerID.valueOf(containerId));
createSecureContainer(client, containerId, token);
closeSecureContainer(client, containerId, token);
} else {
createContainer(client, containerId);
closeContainer(client, containerId);
}
containerIdList.add(containerId++);

// Wait certificate to expire
GenericTestUtils.waitFor(() ->
caClient.getCertificate().getNotAfter().before(new Date()),
500, certLifetime);
100, certLifetime);

List<DatanodeDetails> sourceDatanodes = new ArrayList<>();
sourceDatanodes.add(dn);
Expand Down