Skip to content

Commit 5760a4c

Browse files
authored
Create BUILD.bazel files for test/new-e2e (#54286)
### What does this PR do? - removes gazelle exclude/ignore for test/new-e2e - does the obvious tweaks for data statements - Excludes execution from the legacy bazel smoke test job. Few, if any, of them can run outside of the e2e job. ### Motivation - Eventually speed up building the e2e tests by relying on bazel caching. - First step in declaring e2e tests as Bazel targets. - Moves us closer to having no need for direct `go build`. ### Describe how you validated your changes CI ### Futures - Tease apart the unit tests for the test framework itself and have those run in the regular bazel test jobs. No point in doing that today because we are shortly replacing the smoke test job and the flavor jobs with a flavorless job. - strawman: Mark the e2e binaries that spin up infrastructure as tags=E2E. Then use `--test_tag_filter` to not include them in the generic jobs. Co-authored-by: tony.aiuto <tony.aiuto@datadoghq.com>
1 parent d92193f commit 5760a4c

92 files changed

Lines changed: 3794 additions & 70 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitlab/build/bazel/test.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ bazel:coverage:linux-amd64:
3636
extends: [.bazel:test:reporting, .bazel:runner:linux-amd64, .bazel:test]
3737
script:
3838
- !reference [.bazel:test:reporting:ci_links]
39-
- bazel coverage --config=go --config=gorace --config=dd-agent-go-tests-only --jobs=$KUBERNETES_CPU_REQUEST --build_tests_only --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE //...
39+
- bazel coverage --config=go --config=gorace --config=dd-agent-go-tests-only --jobs=$KUBERNETES_CPU_REQUEST --build_tests_only --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE //... -- -//test/new-e2e/...
4040
after_script:
4141
- !reference [.bazel:test:reporting, after_script]
4242
- cp "$(bazel info output_path)/_coverage/_coverage_report.dat" "$CI_PROJECT_DIR/coverage-bazel-$CI_JOB_NAME_SLUG.out"
@@ -52,20 +52,20 @@ bazel:test:linux-amd64:
5252
extends: [.bazel:test:reporting, .bazel:runner:linux-amd64, .bazel:test]
5353
script:
5454
- !reference [.bazel:test:reporting:ci_links]
55-
- bazel test --config=gorace --jobs=$KUBERNETES_CPU_REQUEST --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE //...
55+
- bazel test --config=gorace --jobs=$KUBERNETES_CPU_REQUEST --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE //... -- -//test/new-e2e/...
5656

5757
bazel:test:linux-arm64:
5858
extends: [.bazel:test:reporting, .bazel:runner:linux-arm64, .bazel:test]
5959
script:
6060
- !reference [.bazel:test:reporting:ci_links]
61-
- bazel test --config=gorace --jobs=$KUBERNETES_CPU_REQUEST --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE //...
61+
- bazel test --config=gorace --jobs=$KUBERNETES_CPU_REQUEST --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE //... -- -//test/new-e2e/...
6262

6363
bazel:test:macos-amd64:
6464
extends: [.bazel:test:reporting, .bazel:runner:macos-amd64, .bazel:test]
6565
script:
6666
- !reference [.install_python_dependencies]
6767
- !reference [.bazel:test:reporting:ci_links]
68-
- bazel test --config=gorace --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE //...
68+
- bazel test --config=gorace --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE //... -- -//test/new-e2e/...
6969
after_script:
7070
- !reference [.install_python_dependencies]
7171
- !reference [.bazel:test:reporting, after_script]
@@ -75,7 +75,7 @@ bazel:test:macos-arm64:
7575
script:
7676
- !reference [.install_python_dependencies]
7777
- !reference [.bazel:test:reporting:ci_links]
78-
- bazel test --config=gorace --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE --execution_log_compact_file=$CI_PROJECT_DIR/bazel-exec.log //...
78+
- bazel test --config=gorace --keep_going --remote_download_outputs=toplevel --build_event_json_file=$BEP_FILE --execution_log_compact_file=$CI_PROJECT_DIR/bazel-exec.log //... -- -//test/new-e2e/...
7979
after_script:
8080
- !reference [.install_python_dependencies]
8181
- !reference [.bazel:test:reporting, after_script]
@@ -94,13 +94,16 @@ bazel:test:windows-amd64:
9494
variables:
9595
POWERSHELL_SCRIPT: >-
9696
bazel test --config=gorace --config=no-dd-agent-go-tests --keep_going //... --
97+
-//test/new-e2e/...
9798
-//bazel/rules/dd_packaging/...
9899
-//packages/agent/linux/...
99100
100101
bazel:test:windows-amd64:go:
101102
extends: [.bazel:runner:windows-amd64, .bazel:test]
102103
variables:
103104
POWERSHELL_SCRIPT: >-
104-
bazel test --config=gorace --config=dd-agent-go-tests-only --build_tests_only --keep_going //... --
105+
bazel test --config=gorace --config=dd-agent-go-tests-only --build_tests_only --keep_going
106+
//... --
107+
-//test/new-e2e/...
105108
-//bazel/rules/dd_packaging/...
106109
-//packages/agent/linux/...

BUILD.bazel

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -66,62 +66,6 @@ exports_files(["go.mod"])
6666
# library.
6767
# gazelle:exclude pkg/ebpf/ebpftest/cgo_align.go
6868
# gazelle:resolve go github.com/DataDog/datadog-agent/pkg/ebpf/ebpftest //pkg/ebpf/ebpftest
69-
# gazelle:exclude test/new-e2e/examples
70-
# gazelle:exclude test/new-e2e/system-probe/config
71-
# gazelle:exclude test/new-e2e/system-probe/test
72-
# gazelle:exclude test/new-e2e/tests/agent-configuration
73-
# gazelle:exclude test/new-e2e/tests/agent-devx
74-
# gazelle:exclude test/new-e2e/tests/agent-health
75-
# gazelle:exclude test/new-e2e/tests/agent-log-pipelines
76-
# gazelle:exclude test/new-e2e/tests/agent-metric-pipelines
77-
# gazelle:exclude test/new-e2e/tests/agent-platform/common
78-
# gazelle:exclude test/new-e2e/tests/agent-platform/tests
79-
# gazelle:exclude test/new-e2e/tests/agent-runtimes
80-
# gazelle:exclude test/new-e2e/tests/agent-subcommands/check
81-
# gazelle:exclude test/new-e2e/tests/agent-subcommands/dogstatsdreplay
82-
# gazelle:exclude test/new-e2e/tests/agent-subcommands/status
83-
# gazelle:exclude test/new-e2e/tests/agent-telemetry
84-
# gazelle:exclude test/new-e2e/tests/anomalydetection
85-
# gazelle:exclude test/new-e2e/tests/apm
86-
# gazelle:exclude test/new-e2e/tests/autoscaling/spot
87-
# gazelle:exclude test/new-e2e/tests/containers
88-
# gazelle:exclude test/new-e2e/tests/cspm
89-
# gazelle:exclude test/new-e2e/tests/cws/api
90-
# gazelle:exclude test/new-e2e/tests/discovery
91-
# gazelle:exclude test/new-e2e/tests/ddot
92-
# gazelle:exclude test/new-e2e/tests/fips-compliance
93-
# gazelle:exclude test/new-e2e/tests/fleet
94-
# gazelle:exclude test/new-e2e/tests/gpu
95-
# gazelle:exclude test/new-e2e/tests/ha-agent
96-
# gazelle:exclude test/new-e2e/tests/installer/host
97-
# gazelle:exclude test/new-e2e/tests/installer/script
98-
# gazelle:exclude test/new-e2e/tests/installer/unix
99-
# gazelle:exclude test/new-e2e/tests/installer/windows/fixtures
100-
# gazelle:exclude test/new-e2e/tests/installer/windows/remote-host-assertions
101-
# gazelle:exclude test/new-e2e/tests/installer/windows/resources
102-
# gazelle:exclude test/new-e2e/tests/installer/windows/suite-assertions
103-
# gazelle:exclude test/new-e2e/tests/language-detection
104-
# gazelle:exclude test/new-e2e/tests/ndm
105-
# gazelle:exclude test/new-e2e/tests/netpath
106-
# gazelle:exclude test/new-e2e/tests/npm
107-
# gazelle:exclude test/new-e2e/tests/orchestrator
108-
# gazelle:exclude test/new-e2e/tests/otel
109-
# gazelle:exclude test/new-e2e/tests/privateactionrunner
110-
# gazelle:exclude test/new-e2e/tests/process
111-
# gazelle:exclude test/new-e2e/tests/remote-config
112-
# gazelle:exclude test/new-e2e/tests/sbom
113-
# gazelle:exclude test/new-e2e/tests/security-agent-functional
114-
# gazelle:exclude test/new-e2e/tests/ssi
115-
# gazelle:exclude test/new-e2e/tests/ssi-gradual-rollout
116-
# gazelle:exclude test/new-e2e/tests/sysprobe-functional
117-
# gazelle:exclude test/new-e2e/tests/usm
118-
# gazelle:exclude test/new-e2e/tests/windows/common/fixtures
119-
# gazelle:exclude test/new-e2e/tests/windows/domain-test
120-
# gazelle:exclude test/new-e2e/tests/windows/fips-test
121-
# gazelle:exclude test/new-e2e/tests/windows/install-test
122-
# gazelle:exclude test/new-e2e/tests/windows/scripts
123-
# gazelle:exclude test/new-e2e/tests/windows/service-test
124-
# gazelle:exclude test/new-e2e/tests/windows/windows-certificate
12569
# gazelle:exclude internal/qbranch/anomalydetection-testbench
12670
# gazelle:exclude tools/retry_file_dump
12771
# gazelle:exclude vendor

cmd/agent/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ load("@rules_go//go:def.bzl", "go_library")
22
load("//bazel/rules/go:go_binary.bzl", "dd_agent_go_binary")
33
load("//tasks:build_tags.bzl", "AGENT_TAGS")
44

5+
exports_files(["macos/uninstall_mac_os.sh"])
6+
57
go_library(
68
name = "agent_lib",
79
srcs = [

test/new-e2e/examples/BUILD.bazel

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
load("//bazel/rules/go:dd_agent_go_test.bzl", "dd_agent_go_test")
2+
3+
dd_agent_go_test(
4+
name = "examples_test",
5+
srcs = [
6+
"agentenv_checkruns_test.go",
7+
"agentenv_copyfolder_test.go",
8+
"agentenv_file_permissions_test.go",
9+
"agentenv_file_permissions_win_test.go",
10+
"agentenv_logs_test.go",
11+
"agentenv_metrics_test.go",
12+
"agentenv_rc_loglevel_test.go",
13+
"agentenv_updateenv_test.go",
14+
"aks_test.go",
15+
"azure_vm_test.go",
16+
"customenv_with_docker_app_test.go",
17+
"customenv_with_filemanager_test.go",
18+
"customenv_with_two_vm_test.go",
19+
"dockerenv_test.go",
20+
"dockerenv_with_extra_compose_test.go",
21+
"ecs_test.go",
22+
"eks_test.go",
23+
"gcp_vm_test.go",
24+
"gke_autopilot_test.go",
25+
"gke_test.go",
26+
"kind_local_operator_test.go",
27+
"kind_local_test.go",
28+
"kind_operator_test.go",
29+
"kind_rc_loglevel_test.go",
30+
"kind_test.go",
31+
"openshiftvm_test.go",
32+
"suite_serial_kube_test.go",
33+
"vm_localpodman_test.go",
34+
"vm_test.go",
35+
"vm_with_file_operations_test.go",
36+
"vmenv_artifacts_test.go",
37+
"vmenv_withami_test.go",
38+
"vmenv_withos_test.go",
39+
],
40+
data = [
41+
"testfixtures/custom_logs.yaml",
42+
"testfixtures/docker-compose.fake-process.yaml",
43+
"testfixtures/docker-compose.lighttpd.yaml",
44+
"testfixtures/lighttpd.conf",
45+
"testfixtures/lighttpd_integration.conf.yaml",
46+
],
47+
embedsrcs = [
48+
"testfixtures/custom_logs.yaml",
49+
"testfixtures/docker-compose.fake-process.yaml",
50+
"testfixtures/docker-compose.lighttpd.yaml",
51+
"testfixtures/lighttpd.conf",
52+
"testfixtures/lighttpd_integration.conf.yaml",
53+
],
54+
deps = [
55+
"//test/e2e-framework/common/config",
56+
"//test/e2e-framework/components/datadog/agent",
57+
"//test/e2e-framework/components/datadog/agentparams",
58+
"//test/e2e-framework/components/datadog/agentparams/filepermissions",
59+
"//test/e2e-framework/components/datadog/agentwithoperatorparams",
60+
"//test/e2e-framework/components/datadog/apps/dogstatsd",
61+
"//test/e2e-framework/components/datadog/apps/nginx",
62+
"//test/e2e-framework/components/datadog/dockeragentparams",
63+
"//test/e2e-framework/components/datadog/fakeintake",
64+
"//test/e2e-framework/components/datadog/kubernetesagentparams",
65+
"//test/e2e-framework/components/datadog/operator",
66+
"//test/e2e-framework/components/datadog/operatorparams",
67+
"//test/e2e-framework/components/docker",
68+
"//test/e2e-framework/components/kubernetes",
69+
"//test/e2e-framework/components/os",
70+
"//test/e2e-framework/resources/aws",
71+
"//test/e2e-framework/resources/local",
72+
"//test/e2e-framework/scenarios/aws/ec2",
73+
"//test/e2e-framework/scenarios/aws/ec2docker",
74+
"//test/e2e-framework/scenarios/aws/ecs",
75+
"//test/e2e-framework/scenarios/aws/eks",
76+
"//test/e2e-framework/scenarios/aws/fakeintake",
77+
"//test/e2e-framework/scenarios/aws/kindvm",
78+
"//test/e2e-framework/scenarios/gcp/gke",
79+
"//test/e2e-framework/testing/components",
80+
"//test/e2e-framework/testing/e2e",
81+
"//test/e2e-framework/testing/environments",
82+
"//test/e2e-framework/testing/provisioners",
83+
"//test/e2e-framework/testing/provisioners/aws/docker",
84+
"//test/e2e-framework/testing/provisioners/aws/ecs",
85+
"//test/e2e-framework/testing/provisioners/aws/host",
86+
"//test/e2e-framework/testing/provisioners/aws/kubernetes/eks",
87+
"//test/e2e-framework/testing/provisioners/aws/kubernetes/kindvm",
88+
"//test/e2e-framework/testing/provisioners/azure/host/windows",
89+
"//test/e2e-framework/testing/provisioners/azure/kubernetes",
90+
"//test/e2e-framework/testing/provisioners/gcp/host/linux",
91+
"//test/e2e-framework/testing/provisioners/gcp/kubernetes",
92+
"//test/e2e-framework/testing/provisioners/gcp/kubernetes/openshiftvm",
93+
"//test/e2e-framework/testing/provisioners/local/host",
94+
"//test/e2e-framework/testing/provisioners/local/kubernetes",
95+
"//test/e2e-framework/testing/runner",
96+
"//test/e2e-framework/testing/utils/e2e/client",
97+
"//test/e2e-framework/testing/utils/e2e/client/agentclient",
98+
"//test/fakeintake/client",
99+
"//test/new-e2e/tests/agent-configuration/secretsutils",
100+
"@com_github_aws_aws_sdk_go_v2//aws",
101+
"@com_github_aws_aws_sdk_go_v2_service_ecs//:ecs",
102+
"@com_github_pulumi_pulumi_kubernetes_sdk_v4//go/kubernetes",
103+
"@com_github_pulumi_pulumi_sdk_v3//go/auto",
104+
"@com_github_pulumi_pulumi_sdk_v3//go/pulumi",
105+
"@com_github_stretchr_testify//assert",
106+
"@com_github_stretchr_testify//require",
107+
"@io_k8s_api//core/v1:core",
108+
"@io_k8s_apimachinery//pkg/apis/meta/v1:meta",
109+
"@org_golang_x_crypto//ssh",
110+
],
111+
)
Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,62 @@
1-
# gazelle:ignore
1+
load("@rules_go//go:def.bzl", "go_binary", "go_library")
2+
3+
go_library(
4+
name = "system-probe_lib",
5+
srcs = ["main.go"],
6+
importpath = "github.com/DataDog/datadog-agent/test/new-e2e/scenarios/system-probe",
7+
visibility = ["//visibility:private"],
8+
deps = select({
9+
"@rules_go//go/platform:aix": [
10+
"//test/new-e2e/system-probe",
11+
],
12+
"@rules_go//go/platform:android": [
13+
"//test/new-e2e/system-probe",
14+
],
15+
"@rules_go//go/platform:darwin": [
16+
"//test/new-e2e/system-probe",
17+
],
18+
"@rules_go//go/platform:dragonfly": [
19+
"//test/new-e2e/system-probe",
20+
],
21+
"@rules_go//go/platform:freebsd": [
22+
"//test/new-e2e/system-probe",
23+
],
24+
"@rules_go//go/platform:illumos": [
25+
"//test/new-e2e/system-probe",
26+
],
27+
"@rules_go//go/platform:ios": [
28+
"//test/new-e2e/system-probe",
29+
],
30+
"@rules_go//go/platform:js": [
31+
"//test/new-e2e/system-probe",
32+
],
33+
"@rules_go//go/platform:linux": [
34+
"//test/new-e2e/system-probe",
35+
],
36+
"@rules_go//go/platform:netbsd": [
37+
"//test/new-e2e/system-probe",
38+
],
39+
"@rules_go//go/platform:openbsd": [
40+
"//test/new-e2e/system-probe",
41+
],
42+
"@rules_go//go/platform:osx": [
43+
"//test/new-e2e/system-probe",
44+
],
45+
"@rules_go//go/platform:plan9": [
46+
"//test/new-e2e/system-probe",
47+
],
48+
"@rules_go//go/platform:qnx": [
49+
"//test/new-e2e/system-probe",
50+
],
51+
"@rules_go//go/platform:solaris": [
52+
"//test/new-e2e/system-probe",
53+
],
54+
"//conditions:default": [],
55+
}),
56+
)
57+
58+
go_binary(
59+
name = "system-probe",
60+
embed = [":system-probe_lib"],
61+
visibility = ["//visibility:public"],
62+
)

0 commit comments

Comments
 (0)