diff --git a/.github/workflows/integration-comment.yml b/.github/workflows/integration-comment.yml index a35f994f82f25..c53dd0bc6ac7f 100644 --- a/.github/workflows/integration-comment.yml +++ b/.github/workflows/integration-comment.yml @@ -69,90 +69,299 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} status: pending - test-integration: - uses: ./.github/workflows/integration-test.yml - with: - if: ${{ matrix.run.if }} - test_name: ${{ matrix.run.test_name }} + integration-tests: needs: prep-pr - secrets: inherit - strategy: - fail-fast: false - matrix: - run: - - test_name: 'amqp' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-amqp') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'appsignal' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-appsignal') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'aws' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-aws') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'axiom' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-axiom') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'azure' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-azure') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'clickhouse' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-clickhouse') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'databend' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-databend') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'datadog-agent' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'datadog-logs' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'datadog-metrics' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'datadog-traces' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'dnstap' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-dnstap') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'docker-logs' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-docker-logs') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'elasticsearch' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-elasticsearch') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'eventstoredb' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-eventstoredb') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'fluent' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-fluent') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'gcp' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-gcp') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'humio' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-humio') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'http-client' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-http-client') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'influxdb' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-influxdb') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'kafka' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-kafka') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'logstash' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-logstash') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'loki' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-loki') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'mongodb' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-mongodb') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'nats' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-nats') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'nginx' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-nginx') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'opentelemetry' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-opentelemetry') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'postgres' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-postgres') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'prometheus' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-prometheus') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'pulsar' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-pulsar') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'redis' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-redis') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'shutdown' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-shutdown') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'splunk' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-splunk') || contains(github.event.comment.body, '/ci-run-all') }} - - test_name: 'webhdfs' - if: ${{ contains(github.event.comment.body, '/ci-run-integration-webhdfs') || contains(github.event.comment.body, '/ci-run-all') }} + runs-on: [linux, ubuntu-20.04-4core] + steps: + - uses: actions/checkout@v3 + with: + submodules: "recursive" + + - run: sudo npm -g install @datadog/datadog-ci + + - run: docker image prune -af ; docker container prune -f + + - name: amqp + if: ${{ contains(github.event.comment.body, '/ci-run-integration-amqp') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + # First one requires more time, as we need to build the image from scratch + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh amqp + + - name: appsignal + if: ${{ contains(github.event.comment.body, '/ci-run-integration-appsignal') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh appsignal + + - name: aws + if: ${{ contains(github.event.comment.body, '/ci-run-integration-aws') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh aws + + - name: axiom + if: ${{ contains(github.event.comment.body, '/ci-run-integration-axiom') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh axiom + + - name: azure + if: ${{ contains(github.event.comment.body, '/ci-run-integration-azure') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh azure + + - name: clickhouse + if: ${{ contains(github.event.comment.body, '/ci-run-integration-clickhouse') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh clickhouse + + - name: databend + if: ${{ contains(github.event.comment.body, '/ci-run-integration-databend') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh databend + + - name: datadog-agent + if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog-agent') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh datadog-agent + + - name: datadog-logs + if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog-logs') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh datadog-logs + + - name: datadog-metrics + if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog-metrics') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh datadog-metrics + + - name: datadog-traces + if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog-traces') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh datadog-traces + + - name: dnstap + if: ${{ contains(github.event.comment.body, '/ci-run-integration-dnstap') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh dnstap + + - run: docker image prune -af --filter=label!=vector-test-runner=true ; docker container prune -f + + - name: docker-logs + if: ${{ contains(github.event.comment.body, '/ci-run-integration-docker-logs') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh docker-logs + + - name: elasticsearch + if: ${{ contains(github.event.comment.body, '/ci-run-integration-elasticsearch') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh elasticsearch + + - name: eventstoredb + if: ${{ contains(github.event.comment.body, '/ci-run-integration-eventstoredb') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh eventstoredb + + - name: fluent + if: ${{ contains(github.event.comment.body, '/ci-run-integration-fluent') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh fluent + + - name: gcp + if: ${{ contains(github.event.comment.body, '/ci-run-integration-gcp') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh gcp + + - name: humio + if: ${{ contains(github.event.comment.body, '/ci-run-integration-humio') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh humio + + - name: http-client + if: ${{ contains(github.event.comment.body, '/ci-run-integration-http-client') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh http-client + + - name: influxdb + if: ${{ contains(github.event.comment.body, '/ci-run-integration-influxdb') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh influxdb + + - name: kafka + if: ${{ contains(github.event.comment.body, '/ci-run-integration-kafka') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh kafka + + - name: logstash + if: ${{ contains(github.event.comment.body, '/ci-run-integration-logstash') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh logstash + + - name: loki + if: ${{ contains(github.event.comment.body, '/ci-run-integration-loki') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh loki + + - name: mongodb + if: ${{ contains(github.event.comment.body, '/ci-run-integration-mongodb') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh mongodb + + - run: docker image prune -af --filter=label!=vector-test-runner=true ; docker container prune -f + + - name: nats + if: ${{ contains(github.event.comment.body, '/ci-run-integration-nats') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh nats + + - name: nginx + if: ${{ contains(github.event.comment.body, '/ci-run-integration-nginx') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh nginx + + - name: opentelemetry + if: ${{ contains(github.event.comment.body, '/ci-run-integration-opentelemetry') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh opentelemetry + + - name: postgres + if: ${{ contains(github.event.comment.body, '/ci-run-integration-postgres') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh postgres + + - name: prometheus + if: ${{ contains(github.event.comment.body, '/ci-run-integration-prometheus') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh prometheus + + - name: pulsar + if: ${{ contains(github.event.comment.body, '/ci-run-integration-pulsar') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh pulsar + + - name: redis + if: ${{ contains(github.event.comment.body, '/ci-run-integration-redis') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh redis + + - name: shutdown + if: ${{ contains(github.event.comment.body, '/ci-run-integration-shutdown') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh shutdown + + - name: splunk + if: ${{ contains(github.event.comment.body, '/ci-run-integration-splunk') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh splunk + + - name: webhdfs + if: ${{ contains(github.event.comment.body, '/ci-run-integration-webhdfs') || contains(github.event.comment.body, '/ci-run-all') }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh webhdfs update-pr-status: name: Signal result to PR runs-on: ubuntu-latest - needs: test-integration + needs: integration-tests if: always() && (contains(github.event.comment.body, '/ci-run-integration') || contains(github.event.comment.body, '/ci-run-all')) steps: - name: Validate issue comment diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4d8d635fcb477..ce0dbb195ab4b 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -1,22 +1,12 @@ -# This workflow is used to run an integration test. -# The most common use case is that it is triggered by another workflow, -# such as the Master Merge Queue Suite, or the Integration Comment. +# Integration Test # -# It can also be triggered on manual dispatch in CI however. -# In that use case, an input for the test name needs to be provided. +# This workflow is used to run an integration test on demand. +# An input for the test name needs to be provided. # TODO: check if the input is "all" , and run all, without a timeout? name: Integration Test on: - workflow_call: - inputs: - if: - required: false - type: boolean - test_name: - required: true - type: string workflow_dispatch: inputs: test_name: diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7f85870e7dff4..44543c9ef2017 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -22,6 +22,9 @@ env: CONTAINER_TOOL: "docker" DD_ENV: "ci" DD_API_KEY: ${{ secrets.DD_API_KEY }} + TEST_DATADOG_API_KEY: ${{ secrets.CI_TEST_DATADOG_API_KEY }} + TEST_APPSIGNAL_PUSH_API_KEY: ${{ secrets.TEST_APPSIGNAL_PUSH_API_KEY }} + AXIOM_TOKEN: ${{ secrets.AXIOM_TOKEN }} RUST_BACKTRACE: full TEST_LOG: vector=debug VERBOSE: true @@ -42,94 +45,336 @@ jobs: int_tests: true secrets: inherit - # Calls the Integration Test workflow for each integration that was detected to have files changed that impact it. - integration-matrix: - uses: ./.github/workflows/integration-test.yml - with: - if: ${{ matrix.run.if }} - test_name: ${{ matrix.run.test_name }} - secrets: inherit + integration-tests: + name: Integration Tests + runs-on: [linux, ubuntu-20.04-4core] needs: changes - strategy: - fail-fast: false - matrix: - run: - - test_name: 'amqp' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.amqp == 'true' }} - - test_name: 'appsignal' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.appsignal == 'true' }} - - test_name: 'aws' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.aws == 'true' }} - - test_name: 'axiom' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.axiom == 'true' }} - - test_name: 'azure' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.azure == 'true' }} - - test_name: 'clickhouse' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.clickhouse == 'true' }} - - test_name: 'databend' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.databend == 'true' }} - - test_name: 'datadog-agent' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.datadog == 'true' }} - - test_name: 'datadog-logs' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.datadog == 'true' }} - - test_name: 'datadog-metrics' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.datadog == 'true' }} - - test_name: 'datadog-traces' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.datadog == 'true' }} - - test_name: 'dnstap' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.dnstap == 'true' }} - - test_name: 'docker-logs' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.docker-logs == 'true' }} - - test_name: 'elasticsearch' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.elasticsearch == 'true' }} - - test_name: 'eventstoredb' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.eventstoredb == 'true' }} - - test_name: 'fluent' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.fluent == 'true' }} - - test_name: 'gcp' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.gcp == 'true' }} - - test_name: 'humio' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.humio == 'true' }} - - test_name: 'http-client' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.http-client == 'true' }} - - test_name: 'influxdb' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.influxdb == 'true' }} - - test_name: 'kafka' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.kafka == 'true' }} - - test_name: 'logstash' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.logstash == 'true' }} - - test_name: 'loki' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.loki == 'true' }} - - test_name: 'mongodb' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.mongodb == 'true' }} - - test_name: 'nats' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.nats == 'true' }} - - test_name: 'nginx' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.nginx == 'true' }} - - test_name: 'opentelemetry' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.opentelemetry == 'true' }} - - test_name: 'postgres' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.postgres == 'true' }} - - test_name: 'prometheus' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.prometheus == 'true' }} - - test_name: 'pulsar' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.pulsar == 'true' }} - - test_name: 'redis' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.redis == 'true' }} - - test_name: 'shutdown' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' }} - - test_name: 'splunk' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.splunk == 'true' }} - - test_name: 'webhdfs' - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.int-all == 'true' || needs.changes.outputs.webhdfs == 'true' }} - - # This is a required status check, so it always needs to run if prior jobs failed, in order to mark the status correctly. - integration: + if: | + github.event_name == 'merge_group' || ( + needs.changes.outputs.all-int == 'true' + || needs.changes.outputs.amqp == 'true' + || needs.changes.outputs.appsignal == 'true' + || needs.changes.outputs.aws == 'true' + || needs.changes.outputs.axiom == 'true' + || needs.changes.outputs.azure == 'true' + || needs.changes.outputs.clickhouse == 'true' + || needs.changes.outputs.databend == 'true' + || needs.changes.outputs.datadog == 'true' + || needs.changes.outputs.dnstap == 'true' + || needs.changes.outputs.docker-logs == 'true' + || needs.changes.outputs.elasticsearch == 'true' + || needs.changes.outputs.eventstoredb == 'true' + || needs.changes.outputs.fluent == 'true' + || needs.changes.outputs.gcp == 'true' + || needs.changes.outputs.humio == 'true' + || needs.changes.outputs.http-client == 'true' + || needs.changes.outputs.influxdb == 'true' + || needs.changes.outputs.kafka == 'true' + || needs.changes.outputs.logstash == 'true' + || needs.changes.outputs.loki == 'true' + || needs.changes.outputs.mongodb == 'true' + || needs.changes.outputs.nats == 'true' + || needs.changes.outputs.nginx == 'true' + || needs.changes.outputs.opentelemetry == 'true' + || needs.changes.outputs.postgres == 'true' + || needs.changes.outputs.prometheus == 'true' + || needs.changes.outputs.pulsar == 'true' + || needs.changes.outputs.redis == 'true' + || needs.changes.outputs.splunk == 'true' + || needs.changes.outputs.webhdfs == 'true' + ) + timeout-minutes: 75 + steps: + - uses: actions/checkout@v3 + with: + submodules: "recursive" + + - run: sudo npm -g install @datadog/datadog-ci + + - run: docker image prune -af ; docker container prune -f + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.amqp == 'true' }} + name: amqp + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh amqp + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.appsignal == 'true' }} + name: appsignal + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh appsignal + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.aws == 'true' }} + name: aws + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh aws + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.axiom == 'true' }} + name: axiom + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh axiom + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.azure == 'true' }} + name: azure + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh azure + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.clickhouse == 'true' }} + name: clickhouse + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh clickhouse + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.databend == 'true' }} + name: databend + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh databend + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true' }} + name: datadog-agent + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh datadog-agent + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true' }} + name: datadog-logs + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh datadog-logs + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true' }} + name: datadog-metrics + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh datadog-metrics + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true' }} + name: datadog-traces + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh datadog-traces + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.dnstap == 'true' }} + name: dnstap + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh dnstap + + - run: docker image prune -af --filter=label!=vector-test-runner=true ; docker container prune -f + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.docker-logs == 'true' }} + name: docker-logs + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh docker-logs + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.elasticsearch == 'true' }} + name: elasticsearch + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh elasticsearch + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.eventstoredb == 'true' }} + name: eventstoredb + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh eventstoredb + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.fluent == 'true' }} + name: fluent + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh fluent + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.gcp == 'true' }} + name: gcp + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh gcp + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.humio == 'true' }} + name: humio + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh humio + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.http-client == 'true' }} + name: http-client + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh http-client + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.influxdb == 'true' }} + name: influxdb + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh influxdb + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.kafka == 'true' }} + name: kafka + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh kafka + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.logstash == 'true' }} + name: logstash + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh logstash + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.loki == 'true' }} + name: loki + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh loki + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.mongodb == 'true' }} + name: mongodb + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh mongodb + + - run: docker image prune -af --filter=label!=vector-test-runner=true ; docker container prune -f + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.nats == 'true' }} + name: nats + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh nats + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.nginx == 'true' }} + name: nginx + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh nginx + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.opentelemetry == 'true' }} + name: opentelemetry + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh opentelemetry + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.postgres == 'true' }} + name: postgres + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh postgres + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.prometheus == 'true' }} + name: prometheus + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh prometheus + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.pulsar == 'true' }} + name: pulsar + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh pulsar + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.redis == 'true' }} + name: redis + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh redis + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' }} + name: shutdown + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh shutdown + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.splunk == 'true' }} + name: splunk + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh splunk + + - if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.webhdfs == 'true' }} + name: webhdfs + uses: nick-fields/retry@v2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: bash scripts/ci-integration-test.sh webhdfs + + integration-test-suite: name: Integration Test Suite runs-on: ubuntu-latest if: always() needs: - - integration-matrix + - integration-tests env: FAILED: ${{ contains(needs.*.result, 'failure') }} steps: diff --git a/scripts/ci-integration-test.sh b/scripts/ci-integration-test.sh new file mode 100755 index 0000000000000..9687f1c1eafe6 --- /dev/null +++ b/scripts/ci-integration-test.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Used in CI to run and stop an integration test and upload the results of it. +# This is useful to allow retrying the integration test at a higher level than +# the nextest and reduce code duplication in the workflow file. + +set -u + +if [[ -z "${CI:-}" ]]; then + echo "Aborted: this script is for use in CI." >&2 + exit 1 +fi + +if [ $# -ne 1 ] +then + echo "usage: $0 INTEGRATION" + exit 1 +fi + +set -x + +INTEGRATION=$1 + +cargo vdev -v int start "${INTEGRATION}" +sleep 30 +cargo vdev -v int test --retries 2 -a "${INTEGRATION}" +RET=$? +cargo vdev -v int stop -a "${INTEGRATION}" +./scripts/upload-test-results.sh +exit $RET diff --git a/scripts/integration/chronicle/compose.yaml b/scripts/integration/chronicle/compose.yaml deleted file mode 100644 index 09097e24a97de..0000000000000 --- a/scripts/integration/chronicle/compose.yaml +++ /dev/null @@ -1,12 +0,0 @@ -version: '3' - -services: - chronicle-emulator: - image: docker.io/plork/chronicle-emulator:${CONFIG_VERSION} - ports: - - 3000:3000 - volumes: - - ./public.pem:/public.pem:ro - command: - - -p - - /public.pem diff --git a/scripts/integration/chronicle/test.yaml b/scripts/integration/chronicle/test.yaml deleted file mode 100644 index 048e7adbc3aa9..0000000000000 --- a/scripts/integration/chronicle/test.yaml +++ /dev/null @@ -1,10 +0,0 @@ -features: -- chronicle-integration-tests - -test_filter: '::chronicle_unstructured::' - -env: - CHRONICLE_ADDRESS: http://chronicle-emulator:3000 - -matrix: - version: [latest] diff --git a/scripts/integration/chronicle/auth.json b/scripts/integration/gcp/auth.json similarity index 100% rename from scripts/integration/chronicle/auth.json rename to scripts/integration/gcp/auth.json diff --git a/scripts/integration/gcp/compose.yaml b/scripts/integration/gcp/compose.yaml index 643362a2bc76e..3ab1673228b9d 100644 --- a/scripts/integration/gcp/compose.yaml +++ b/scripts/integration/gcp/compose.yaml @@ -6,3 +6,12 @@ services: environment: - PUBSUB_PROJECT1=testproject,topic1:subscription1 - PUBSUB_PROJECT2=sourceproject,topic2:subscription2 + chronicle-emulator: + image: docker.io/plork/chronicle-emulator:${CONFIG_VERSION} + ports: + - 3000:3000 + volumes: + - ./public.pem:/public.pem:ro + command: + - -p + - /public.pem diff --git a/scripts/integration/chronicle/invalidauth.json b/scripts/integration/gcp/invalidauth.json similarity index 100% rename from scripts/integration/chronicle/invalidauth.json rename to scripts/integration/gcp/invalidauth.json diff --git a/scripts/integration/chronicle/public.pem b/scripts/integration/gcp/public.pem similarity index 100% rename from scripts/integration/chronicle/public.pem rename to scripts/integration/gcp/public.pem diff --git a/scripts/integration/gcp/test.yaml b/scripts/integration/gcp/test.yaml index 7e516b716fafb..772a416d2162a 100644 --- a/scripts/integration/gcp/test.yaml +++ b/scripts/integration/gcp/test.yaml @@ -1,10 +1,12 @@ features: - gcp-integration-tests +- chronicle-integration-tests test_filter: '::gcp::' env: EMULATOR_ADDRESS: http://gcloud-pubsub:8681 + CHRONICLE_ADDRESS: http://chronicle-emulator:3000 matrix: version: [latest] diff --git a/src/sinks/gcp/chronicle_unstructured.rs b/src/sinks/gcp/chronicle_unstructured.rs index 36a537cb548b6..2e91b15ca3548 100644 --- a/src/sinks/gcp/chronicle_unstructured.rs +++ b/src/sinks/gcp/chronicle_unstructured.rs @@ -550,12 +550,10 @@ mod integration_tests { trace_init(); let log_type = random_string(10); - let (sink, healthcheck) = config_build( - &log_type, - "/home/vector/scripts/integration/chronicle/auth.json", - ) - .await - .expect("Building sink failed"); + let (sink, healthcheck) = + config_build(&log_type, "/home/vector/scripts/integration/gcp/auth.json") + .await + .expect("Building sink failed"); healthcheck.await.expect("Health check failed"); @@ -585,7 +583,7 @@ mod integration_tests { // Test with an auth file that doesnt match the public key sent to the dummy chronicle server. let sink = config_build( &log_type, - "/home/vector/scripts/integration/chronicle/invalidauth.json", + "/home/vector/scripts/integration/gcp/invalidauth.json", ) .await; @@ -599,12 +597,10 @@ mod integration_tests { // The chronicle-emulator we are testing against is setup so a `log_type` of "INVALID" // will return a `400 BAD_REQUEST`. let log_type = "INVALID"; - let (sink, healthcheck) = config_build( - log_type, - "/home/vector/scripts/integration/chronicle/auth.json", - ) - .await - .expect("Building sink failed"); + let (sink, healthcheck) = + config_build(log_type, "/home/vector/scripts/integration/gcp/auth.json") + .await + .expect("Building sink failed"); healthcheck.await.expect("Health check failed"); diff --git a/vdev/src/commands/integration/start.rs b/vdev/src/commands/integration/start.rs index b697029d3dca9..da8947e74997a 100644 --- a/vdev/src/commands/integration/start.rs +++ b/vdev/src/commands/integration/start.rs @@ -24,6 +24,6 @@ impl Cli { let env = envs.keys().next().expect("Integration has no environments"); env.clone() }; - IntegrationTest::new(self.integration, environment)?.start() + IntegrationTest::new(self.integration, environment, false, 0)?.start() } } diff --git a/vdev/src/commands/integration/stop.rs b/vdev/src/commands/integration/stop.rs index 319c9d4643435..22955d5fa7daf 100644 --- a/vdev/src/commands/integration/stop.rs +++ b/vdev/src/commands/integration/stop.rs @@ -9,12 +9,16 @@ use crate::testing::{integration::IntegrationTest, state::EnvsDir}; pub struct Cli { /// The integration name to stop integration: String, + + /// If true, remove the runner container compiled with all integration test features + #[arg(short = 'a', long)] + all_features: bool, } impl Cli { pub fn exec(self) -> Result<()> { if let Some(active) = EnvsDir::new(&self.integration).active()? { - IntegrationTest::new(self.integration, active)?.stop() + IntegrationTest::new(self.integration, active, self.all_features, 0)?.stop() } else { println!("No environment for {:?} is active.", self.integration); Ok(()) diff --git a/vdev/src/commands/integration/test.rs b/vdev/src/commands/integration/test.rs index 459224183973b..ca57d895bd0c8 100644 --- a/vdev/src/commands/integration/test.rs +++ b/vdev/src/commands/integration/test.rs @@ -20,6 +20,14 @@ pub struct Cli { /// The desired environment (optional) environment: Option, + /// Whether to compile the test runner with all integration test features + #[arg(short = 'a', long)] + build_all: bool, + + /// Number of retries to allow on each integration test case. + #[arg(short = 'r', long)] + retries: Option, + /// Extra test command arguments args: Vec, } @@ -30,17 +38,25 @@ impl Cli { let envs = config.environments(); let active = EnvsDir::new(&self.integration).active()?; + + let retries = self.retries.unwrap_or_default(); + match (self.environment, active) { (Some(environment), Some(active)) if environment != active => { bail!("Requested environment {environment:?} does not match active one {active:?}") } (Some(environment), _) => { - IntegrationTest::new(self.integration, environment)?.test(self.args) + IntegrationTest::new(self.integration, environment, self.build_all, retries)? + .test(self.args) + } + (None, Some(active)) => { + IntegrationTest::new(self.integration, active, self.build_all, retries)? + .test(self.args) } - (None, Some(active)) => IntegrationTest::new(self.integration, active)?.test(self.args), (None, None) => { for env_name in envs.keys() { - IntegrationTest::new(&self.integration, env_name)?.test(self.args.clone())?; + IntegrationTest::new(&self.integration, env_name, self.build_all, retries)? + .test(self.args.clone())?; } Ok(()) } diff --git a/vdev/src/testing/integration.rs b/vdev/src/testing/integration.rs index ecac804a98842..9c70543ec4937 100644 --- a/vdev/src/testing/integration.rs +++ b/vdev/src/testing/integration.rs @@ -21,10 +21,17 @@ pub struct IntegrationTest { runner: IntegrationTestRunner, compose: Option, env_config: Environment, + build_all: bool, + retries: u8, } impl IntegrationTest { - pub fn new(integration: impl Into, environment: impl Into) -> Result { + pub fn new( + integration: impl Into, + environment: impl Into, + build_all: bool, + retries: u8, + ) -> Result { let integration = integration.into(); let environment = environment.into(); let (test_dir, config) = IntegrationTestConfig::load(&integration)?; @@ -34,8 +41,12 @@ impl IntegrationTest { }; let network_name = format!("vector-integration-tests-{integration}"); let compose = Compose::new(test_dir, env_config.clone(), network_name.clone())?; + + // None if compiling with all integration test feature flag. + let runner_name = (!build_all).then(|| integration.clone()); + let runner = IntegrationTestRunner::new( - integration.clone(), + runner_name, &config.runner, compose.is_some().then_some(network_name), )?; @@ -48,6 +59,8 @@ impl IntegrationTest { runner, compose, env_config, + build_all, + retries, }) } @@ -69,7 +82,12 @@ impl IntegrationTest { let mut args = self.config.args.clone().unwrap_or_default(); args.push("--features".to_string()); - args.push(self.config.features.join(",")); + + args.push(if self.build_all { + "all-integration-tests".to_string() + } else { + self.config.features.join(",") + }); // If the test field is not present then use the --lib flag match self.config.test { @@ -91,6 +109,11 @@ impl IntegrationTest { args.push("--no-capture".to_string()); } + if self.retries > 0 { + args.push("--retries".to_string()); + args.push(self.retries.to_string()); + } + self.runner .test(&env_vars, &self.config.runner.env, &args)?; diff --git a/vdev/src/testing/runner.rs b/vdev/src/testing/runner.rs index 566eaa268f453..e4fd18cdd015b 100644 --- a/vdev/src/testing/runner.rs +++ b/vdev/src/testing/runner.rs @@ -47,6 +47,13 @@ fn detect_container_tool() -> OsString { fatal!("No container tool could be detected."); } +fn get_rust_version() -> String { + match RustToolchainConfig::parse() { + Ok(config) => config.channel, + Err(error) => fatal!("Could not read `rust-toolchain.toml` file: {error}"), + } +} + fn dockercmd>(args: impl IntoIterator) -> Command { let mut command = Command::new(&*CONTAINER_TOOL); command.args(args); @@ -93,13 +100,6 @@ pub trait ContainerTestRunner: TestRunner { .wait(format!("Stopping container {}", self.container_name())) } - fn get_rust_version(&self) -> String { - match RustToolchainConfig::parse() { - Ok(config) => config.channel, - Err(error) => fatal!("Could not read `rust-toolchain.toml` file: {error}"), - } - } - fn state(&self) -> Result { let mut command = dockercmd(["ps", "-a", "--format", "{{.Names}} {{.State}}"]); let container_name = self.container_name(); @@ -183,8 +183,10 @@ pub trait ContainerTestRunner: TestRunner { &self.image_name(), "--file", dockerfile.to_str().unwrap(), + "--label", + "vector-test-runner=true", "--build-arg", - &format!("RUST_VERSION={}", self.get_rust_version()), + &format!("RUST_VERSION={}", get_rust_version()), ".", ]); @@ -295,7 +297,8 @@ where } pub(super) struct IntegrationTestRunner { - integration: String, + // The integration is None when compiling the runner image with the `all-integration-tests` feature. + integration: Option, needs_docker_socket: bool, network: Option, volumes: Vec, @@ -303,7 +306,7 @@ pub(super) struct IntegrationTestRunner { impl IntegrationTestRunner { pub(super) fn new( - integration: String, + integration: Option, config: &IntegrationRunnerConfig, network: Option, ) -> Result { @@ -344,11 +347,11 @@ impl ContainerTestRunner for IntegrationTestRunner { } fn container_name(&self) -> String { - format!( - "vector-test-runner-{}-{}", - self.integration, - self.get_rust_version() - ) + if let Some(integration) = self.integration.as_ref() { + format!("vector-test-runner-{}-{}", integration, get_rust_version()) + } else { + format!("vector-test-runner-{}", get_rust_version()) + } } fn image_name(&self) -> String { @@ -372,7 +375,7 @@ impl ContainerTestRunner for DockerTestRunner { } fn container_name(&self) -> String { - format!("vector-test-runner-{}", self.get_rust_version()) + format!("vector-test-runner-{}", get_rust_version()) } fn image_name(&self) -> String {