Skip to content

Commit

Permalink
parallelize integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHelmuth committed Jan 31, 2024
1 parent ed487b3 commit 3a783b7
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 15 deletions.
60 changes: 53 additions & 7 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,17 @@ jobs:
group:
- receiver-0
- receiver-1
- receiver-2
- receiver-3
- processor
- exporter
- exporter-0
- exporter-1
- extension
- connector
- internal
- pkg
- cmd
- cmd-0
- cmd-1
- other
runs-on: ubuntu-latest
needs: [setup-environment]
Expand Down Expand Up @@ -130,12 +134,17 @@ jobs:
group:
- receiver-0
- receiver-1
- receiver-2
- receiver-3
- processor
- exporter
- exporter-0
- exporter-1
- extension
- connector
- internal
- pkg
- cmd-0
- cmd-1
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -231,13 +240,17 @@ jobs:
group:
- receiver-0
- receiver-1
- receiver-2
- receiver-3
- processor
- exporter
- exporter-0
- exporter-1
- extension
- connector
- internal
- pkg
- cmd
- cmd-0
- cmd-1
- other
runs-on: ubuntu-latest
needs: [setup-environment]
Expand Down Expand Up @@ -312,7 +325,23 @@ jobs:
attempt_limit: 10
attempt_delay: 15000

integration-tests:
integration-tests-matrix:
strategy:
matrix:
group:
- receiver-0
- receiver-1
- receiver-2
- receiver-3
- processor
- exporter-0
- exporter-1
- extension
- connector
- internal
- pkg
- cmd-0
- cmd-1
runs-on: ubuntu-latest
needs: [setup-environment]
steps:
Expand All @@ -331,7 +360,24 @@ jobs:
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Run Integration Tests
run: make integration-test
run: make gointegration-test GROUP=${{ matrix.group }}

integration-tests:
if: ${{ github.actor != 'dependabot[bot]' && always() }}
runs-on: ubuntu-latest
needs: [ setup-environment, integration-tests-matrix ]
steps:
- name: Print result
run: echo ${{ needs.integration-tests-matrix.result }}
- name: Interpret result
run: |
if [[ success == ${{ needs.integration-tests-matrix.result }} ]]
then
echo "All matrix jobs passed!"
else
echo "One or more matrix jobs failed."
false
fi
correctness-traces:
runs-on: ubuntu-latest
Expand Down
47 changes: 39 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,25 @@ EX_CMD=-not -path "./cmd/*"
# NONROOT_MODS includes ./* dirs (excludes . dir)
NONROOT_MODS := $(shell find . $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )

RECEIVER_MODS_0 := $(shell find ./receiver/[a-k]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
RECEIVER_MODS_1 := $(shell find ./receiver/[l-z]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
RECEIVER_MODS := $(RECEIVER_MODS_0) $(RECEIVER_MODS_1)
RECEIVER_MODS_0 := $(shell find ./receiver/[a-f]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
RECEIVER_MODS_1 := $(shell find ./receiver/[g-o]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
RECEIVER_MODS_2 := $(shell find ./receiver/[p]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) ) # Prometheus is special and gets its own section.
RECEIVER_MODS_3 := $(shell find ./receiver/[q-z]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
RECEIVER_MODS := $(RECEIVER_MODS_0) $(RECEIVER_MODS_1) $(RECEIVER_MODS_2) $(RECEIVER_MODS_3)
PROCESSOR_MODS := $(shell find ./processor/* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
EXPORTER_MODS := $(shell find ./exporter/* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
EXPORTER_MODS_0 := $(shell find ./exporter/[a-m]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
EXPORTER_MODS_1 := $(shell find ./exporter/[n-z]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
EXPORTER_MODS := $(EXPORTER_MODS_0) $(EXPORTER_MODS_1)
EXTENSION_MODS := $(shell find ./extension/* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
CONNECTOR_MODS := $(shell find ./connector/* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
INTERNAL_MODS := $(shell find ./internal/* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
PKG_MODS := $(shell find ./pkg/* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
CMD_MODS := $(shell find ./cmd/* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
CMD_MODS_0 := $(shell find ./cmd/[a-m]* $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )
CMD_MODS_1 := $(shell find ./cmd/[n-z]* $(FIND_MOD_ARGS) -not -path "./cmd/otelcontribcol/*" -exec $(TO_MOD_DIR) )
CMD_MODS := $(CMD_MODS_0) $(CMD_MODS_1)
OTHER_MODS := $(shell find . $(EX_COMPONENTS) $(EX_INTERNAL) $(EX_PKG) $(EX_CMD) $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) ) $(PWD)
ALL_MODS := $(RECEIVER_MODS) $(PROCESSOR_MODS) $(EXPORTER_MODS) $(EXTENSION_MODS) $(CONNECTOR_MODS) $(INTERNAL_MODS) $(PKG_MODS) $(CMD_MODS) $(OTHER_MODS)

# find -exec dirname cannot be used to process multiple matching patterns
FIND_INTEGRATION_TEST_MODS={ find . -type f -name "*integration_test.go" & find . -type f -name "*e2e_test.go" -not -path "./testbed/*"; }
INTEGRATION_MODS := $(shell $(FIND_INTEGRATION_TEST_MODS) | xargs $(TO_MOD_DIR) | uniq)

Expand All @@ -52,14 +57,18 @@ all-modules:
all-groups:
@echo "receiver-0: $(RECEIVER_MODS_0)"
@echo "\nreceiver-1: $(RECEIVER_MODS_1)"
@echo "\nreceiver-2: $(RECEIVER_MODS_2)"
@echo "\nreceiver-3: $(RECEIVER_MODS_3)"
@echo "\nreceiver: $(RECEIVER_MODS)"
@echo "\nprocessor: $(PROCESSOR_MODS)"
@echo "\nexporter: $(EXPORTER_MODS)"
@echo "\nexporter-0: $(EXPORTER_MODS_0)"
@echo "\nexporter-1: $(EXPORTER_MODS_1)"
@echo "\nextension: $(EXTENSION_MODS)"
@echo "\nconnector: $(CONNECTOR_MODS)"
@echo "\ninternal: $(INTERNAL_MODS)"
@echo "\npkg: $(PKG_MODS)"
@echo "\ncmd: $(CMD_MODS)"
@echo "\ncmd-0: $(CMD_MODS_0)"
@echo "\ncmd-1: $(CMD_MODS_1)"
@echo "\nother: $(OTHER_MODS)"

.PHONY: all
Expand Down Expand Up @@ -108,6 +117,10 @@ gotest-with-cover:
@$(MAKE) $(FOR_GROUP_TARGET) TARGET="test-with-cover"
$(GOCMD) tool covdata textfmt -i=./coverage/unit -o ./$(GROUP)-coverage.txt

.PHONY: gointegration-test
gointegration-test:
$(MAKE) $(FOR_GROUP_TARGET) TARGET="mod-integration-test"

.PHONY: gofmt
gofmt:
$(MAKE) $(FOR_GROUP_TARGET) TARGET="fmt"
Expand Down Expand Up @@ -164,12 +177,24 @@ for-receiver-0-target: $(RECEIVER_MODS_0)
.PHONY: for-receiver-1-target
for-receiver-1-target: $(RECEIVER_MODS_1)

.PHONY: for-receiver-2-target
for-receiver-2-target: $(RECEIVER_MODS_2)

.PHONY: for-receiver-3-target
for-receiver-3-target: $(RECEIVER_MODS_3)

.PHONY: for-processor-target
for-processor-target: $(PROCESSOR_MODS)

.PHONY: for-exporter-target
for-exporter-target: $(EXPORTER_MODS)

.PHONY: for-exporter-0-target
for-exporter-0-target: $(EXPORTER_MODS_0)

.PHONY: for-exporter-1-target
for-exporter-1-target: $(EXPORTER_MODS_1)

.PHONY: for-extension-target
for-extension-target: $(EXTENSION_MODS)

Expand All @@ -185,6 +210,12 @@ for-pkg-target: $(PKG_MODS)
.PHONY: for-cmd-target
for-cmd-target: $(CMD_MODS)

.PHONY: for-cmd-0-target
for-cmd-0-target: $(CMD_MODS_0)

.PHONY: for-cmd-1-target
for-cmd-1-target: $(CMD_MODS_1)

.PHONY: for-other-target
for-other-target: $(OTHER_MODS)

Expand Down

0 comments on commit 3a783b7

Please sign in to comment.