Skip to content

Commit

Permalink
merge: #11040
Browse files Browse the repository at this point in the history
11040: ci(smoke-test): multi-arch container smoke test r=megglos a=megglos

## Description

Docker builds and smoke tests are only run on Linux machines as building docker containers on macOS and windows runners introduces complexity to the CI setup that we consider not worth the effort:
- macOS runners require the setup of [colima as a docker runtime](actions/runner-images#6216) which adds another 1.5-2m to the runtime
- on macOS testcontainers failed to detect the docker environment unless [additional environment variables](https://www.testcontainers.org/features/configuration/#customizing-docker-host-detection) have been set 
- some docker related actions are not supported on windows runners like [`docker/build-push-action`](docker/build-push-action#18 (comment))
- the docker setup on Githubs windows runners seems to be bound to the `windows/amd64` platform, see e.g. this [log](https://github.com/camunda/zeebe/actions/runs/3500015748/jobs/5862231609)

Usage of native arm64 runners is listed as a separate sub-task on #10986.


## Related issues

closes #11020



Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
Co-authored-by: Sebastian Bathke (Meggle) <sebastian.bathke@camunda.com>
  • Loading branch information
zeebe-bors-camunda[bot] and megglos committed Nov 24, 2022
2 parents 601c718 + b74fbdb commit 2017e37
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -172,13 +172,17 @@ jobs:
with:
name: "unit tests"
smoke-tests:
name: Smoke tests on ${{ matrix.os }}
name: Smoke tests ${{ matrix.os }} on ${{ matrix.arch }}
timeout-minutes: 20
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
arch: [ amd64 ]
include:
- os: ubuntu-latest
arch: arm64
env:
JAVA_TOOL_OPTIONS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64M
steps:
Expand All @@ -189,21 +193,36 @@ jobs:
# setting up maven often times out on macOS
maven: ${{ matrix.os != 'macos-latest' }}
- uses: ./.github/actions/build-zeebe
id: build-zeebe
with:
go: false
maven-extra-args: -am -pl qa/integration-tests -T1C
- name: Run smoke test
maven-extra-args: -T1C
- uses: ./.github/actions/build-docker
id: build-docker
# Currently only Linux runners support building docker images without further ado
if: ${{ runner.os == 'Linux' }}
with:
version: current-test
distball: ${{ steps.build-zeebe.outputs.distball }}
platforms: linux/${{ matrix.arch }}
push: false
- name: Run smoke test on ${{ matrix.arch }}
env:
DOCKER_DEFAULT_PLATFORM: linux/${{ matrix.arch }}
# For non Linux runners there is no container available for testing, see build-docker job
EXCLUDED_TEST_GROUPS: ${{ runner.os != 'Linux' && 'container' }}
run: >
mvn -B --no-snapshot-updates
-DskipUTs -DskipChecks -Dsurefire.rerunFailingTestsCount=3
-pl qa/integration-tests
-P smoke-test,extract-flaky-tests
-D excludedGroups=$EXCLUDED_TEST_GROUPS
verify
- name: Upload test artifacts
uses: ./.github/actions/collect-test-artifacts
if: always()
with:
name: Smoke Tests ${{ matrix.os }}
name: Smoke Tests ${{ matrix.os }} on ${{ matrix.arch }}
property-tests:
name: Property Tests
runs-on: [ self-hosted, linux, "16" ]
Expand Down
@@ -0,0 +1,76 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Zeebe Community License 1.1. You may not use this file
* except in compliance with the Zeebe Community License 1.1.
*/
package io.camunda.zeebe.it.smoke;

import static org.assertj.core.api.Assertions.assertThat;

import io.camunda.zeebe.client.api.response.DeploymentEvent;
import io.camunda.zeebe.client.api.response.ProcessInstanceResult;
import io.camunda.zeebe.model.bpmn.Bpmn;
import io.camunda.zeebe.model.bpmn.BpmnModelInstance;
import io.camunda.zeebe.qa.util.testcontainers.ZeebeTestContainerDefaults;
import io.zeebe.containers.cluster.ZeebeCluster;
import java.util.concurrent.TimeUnit;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

@Testcontainers
final class ContainerClusterSmokeIT {

@Container
private final ZeebeCluster cluster =
ZeebeCluster.builder()
.withBrokersCount(1)
.withGatewaysCount(1)
.withPartitionsCount(1)
.withEmbeddedGateway(false)
.withImage(ZeebeTestContainerDefaults.defaultTestImage())
.build();

/** A smoke test which checks that a gateway of a cluster can be accessed. */
@ContainerSmokeTest
void connectSmokeTest() {
// given
try (final var client = cluster.newClientBuilder().build()) {
// when
final var topology = client.newTopologyRequest().send();

// then
final var result = topology.join(5L, TimeUnit.SECONDS);
assertThat(result.getBrokers()).as("There is one connected broker").hasSize(1);
}
}

@ContainerSmokeTest
void deployModelAndStartInstance() {
// given
final BpmnModelInstance processModel =
Bpmn.createExecutableProcess("smoke").startEvent().endEvent().done();
try (final var client = cluster.newClientBuilder().build()) {
// when
final DeploymentEvent deploymentEvent =
client
.newDeployResourceCommand()
.addProcessModel(processModel, "smoke.bpmn")
.send()
.join();
final ProcessInstanceResult processInstanceResult =
client
.newCreateInstanceCommand()
.bpmnProcessId("smoke")
.latestVersion()
.withResult()
.send()
.join();

// then
assertThat(processInstanceResult.getProcessDefinitionKey())
.isEqualTo(deploymentEvent.getProcesses().get(0).getProcessDefinitionKey());
}
}
}
@@ -0,0 +1,25 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Zeebe Community License 1.1. You may not use this file
* except in compliance with the Zeebe Community License 1.1.
*/
package io.camunda.zeebe.it.smoke;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.jupiter.api.Tag;

/**
* {@code @ContainerSmokeTest} is used to signal that the annotated method is a container based
* smoke test case, a special kind of {@link @SmokeTest} that verifies the system running within
* containers.
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Tag("container")
@SmokeTest
public @interface ContainerSmokeTest {}
Expand Up @@ -8,14 +8,22 @@
package io.camunda.zeebe.it.smoke;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

/**
* {@code @SmokeTest} is used to signal that the annotated method is smoke test case.
*
* <p>A smoke test is simple test case that verifies whether the system starts properly by verifying
* health indicators and/or by performing simple API interaction.
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Tag("smoke-test")
@Test
@Inherited
public @interface SmokeTest {}

0 comments on commit 2017e37

Please sign in to comment.