From b595fdb703cb48c265b73a07e963f8aec3f14826 Mon Sep 17 00:00:00 2001 From: Braydon Kains <93549768+braydonk@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:42:03 -0700 Subject: [PATCH] Add transformation test make target and docs (#1722) Signed-off-by: braydonk --- .gitignore | 10 ++- builds/agent_wrapper.sh | 14 ++++ builds/fluent_bit.sh | 14 ++++ builds/ops_agent_diagnostics.sh | 14 ++++ builds/otel.sh | 71 +++++++++++++------ builds/systemd.sh | 14 ++++ cloudbuild/new-distro-detector/run.sh | 14 ++++ cmd/agent_wrapper/main_test.go | 14 ++++ .../feature_tracking_internal_test.go | 14 ++++ dev-docs/makefile.md | 12 ++-- dev-docs/transformation-tests.md | 51 +++++++++++++ dockerfiles/compile_test.go | 14 ++++ integration_test/gce/zone_picker.go | 14 ++++ integration_test/mirror_content.sh | 14 ++++ .../applications/couchbase/features.yaml | 14 ++++ .../applications/couchdb/features.yaml | 14 ++++ .../applications/elasticsearch/features.yaml | 14 ++++ .../applications/flink/features.yaml | 14 ++++ .../applications/hadoop/features.yaml | 14 ++++ .../applications/hbase/features.yaml | 14 ++++ .../applications/iis/features.yaml | 14 ++++ .../applications/jetty/features.yaml | 14 ++++ .../applications/jvm/features.yaml | 14 ++++ .../applications/kafka/features.yaml | 14 ++++ .../applications/mariadb/features.yaml | 14 ++++ .../applications/memcached/features.yaml | 14 ++++ .../applications/mongodb/features.yaml | 14 ++++ .../applications/mongodb3.6/features.yaml | 14 ++++ .../applications/mssql/features.yaml | 14 ++++ .../applications/mysql/features.yaml | 14 ++++ .../applications/mysql5.7/features.yaml | 14 ++++ .../applications/nginx/features.yaml | 14 ++++ .../applications/oracledb/features.yaml | 14 ++++ .../applications/postgresql/features.yaml | 14 ++++ .../applications/rabbitmq/features.yaml | 14 ++++ .../applications/redis/features.yaml | 14 ++++ .../applications/solr/features.yaml | 14 ++++ .../applications/tomcat/features.yaml | 14 ++++ .../applications/varnish/features.yaml | 14 ++++ .../applications/vault/features.yaml | 14 ++++ .../applications/wildfly/features.yaml | 14 ++++ .../applications/zookeeper/features.yaml | 14 ++++ internal/secret/string_test.go | 14 ++++ kokoro/scripts/test/build_container.yaml | 14 ++++ kokoro/scripts/test/go_test.Dockerfile | 14 ++++ kokoro/scripts/test/start_soak_test.sh | 14 ++++ project.yaml | 14 ++++ tasks.mak | 70 +++++++++++++++--- transformation_test/transformation_test.go | 33 ++++++--- 49 files changed, 801 insertions(+), 48 deletions(-) create mode 100644 dev-docs/transformation-tests.md diff --git a/.gitignore b/.gitignore index 1d5cf521f1..f529d5c659 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,14 @@ +# Ignore a file actually called Makefile. The presence of this file interferes +# with our Linux package building processes. To make a local symlink called +# "Makefile" for development convenience, use this command: +# make -f tasks.mak makefile_symlink Makefile # Ignore generated credentials from google-github-actions/auth gha-creds-*.json -.vscode/launch.json \ No newline at end of file +# This is a folder used to hold local builds of fluent-bit and otelopscol +# when running transformation tests locally. +dist/ + +.vscode/launch.json diff --git a/builds/agent_wrapper.sh b/builds/agent_wrapper.sh index 36efb4c54c..59b8ace8cf 100755 --- a/builds/agent_wrapper.sh +++ b/builds/agent_wrapper.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -x -e DESTDIR=$1 mkdir -p "$DESTDIR/opt/google-cloud-ops-agent/libexec" diff --git a/builds/fluent_bit.sh b/builds/fluent_bit.sh index d87b435085..e831ef46fb 100755 --- a/builds/fluent_bit.sh +++ b/builds/fluent_bit.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -x -e DESTDIR=$1 mkdir -p $DESTDIR diff --git a/builds/ops_agent_diagnostics.sh b/builds/ops_agent_diagnostics.sh index c31ffdaf0b..993b22537d 100755 --- a/builds/ops_agent_diagnostics.sh +++ b/builds/ops_agent_diagnostics.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -x -e DESTDIR=$1 mkdir -p "$DESTDIR/opt/google-cloud-ops-agent/libexec" diff --git a/builds/otel.sh b/builds/otel.sh index 317cc920ce..d8efb4122b 100755 --- a/builds/otel.sh +++ b/builds/otel.sh @@ -1,26 +1,51 @@ #!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -x -e -DESTDIR=$1 + otel_dir=/opt/google-cloud-ops-agent/subagents/opentelemetry-collector -DESTDIR="${DESTDIR}${otel_dir}" - -cd submodules/opentelemetry-java-contrib -mkdir -p "$DESTDIR" -./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork :jmx-metrics:build -cp jmx-metrics/build/libs/opentelemetry-jmx-metrics-*-alpha-SNAPSHOT.jar "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" - -# Rename LICENSE file because it causes issues with file hash consistency due to an unknown -# issue with the debuild/rpmbuild processes. Something is unzipping the jar in a case-insensitive -# environment and having a conflict between the LICENSE file and license/ directory, leading to a changed jar file -mkdir ./META-INF -unzip -j "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE" -d ./META-INF -zip -d "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE" -mv ./META-INF/LICENSE ./META-INF/LICENSE.renamed -zip -u "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE.renamed" - -cd ../opentelemetry-operations-collector -# Using array assignment to drop the filename from the sha256sum output -JAR_SHA_256=($(sha256sum "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar")) -go build -tags=gpu -buildvcs=false -o "$DESTDIR/otelopscol" \ --ldflags "-X github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver.MetricsGathererHash=$JAR_SHA_256" \ -./cmd/otelopscol +DESTDIR="${1}${otel_dir}" + +mkdir -p $DESTDIR + +LDFLAGS="" + +# If this is not a local build, then we build otel java and add it to +# the ldflags. +if [ "$SKIP_OTEL_JAVA" != "true" ]; then + cd submodules/opentelemetry-java-contrib + + mkdir -p "$DESTDIR" + ./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork :jmx-metrics:build + cp jmx-metrics/build/libs/opentelemetry-jmx-metrics-*-alpha-SNAPSHOT.jar "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" + + # Rename LICENSE file because it causes issues with file hash consistency due to an unknown + # issue with the debuild/rpmbuild processes. Something is unzipping the jar in a case-insensitive + # environment and having a conflict between the LICENSE file and license/ directory, leading to a changed jar file + mkdir ./META-INF + unzip -j "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE" -d ./META-INF + zip -d "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE" + mv ./META-INF/LICENSE ./META-INF/LICENSE.renamed + zip -u "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE.renamed" + + # Using array assignment to drop the filename from the sha256sum output + JAR_SHA_256=($(sha256sum "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar")) + LDFLAGS="-X github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver.MetricsGathererHash=$JAR_SHA_256" + + cd ../.. +fi + +cd submodules/opentelemetry-operations-collector +go build -tags=gpu -buildvcs=false -o "$DESTDIR/otelopscol" -ldflags "$LDFLAGS" ./cmd/otelopscol diff --git a/builds/systemd.sh b/builds/systemd.sh index eb17e581b2..f099e21e2c 100755 --- a/builds/systemd.sh +++ b/builds/systemd.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -x -e DESTDIR=$1 diff --git a/cloudbuild/new-distro-detector/run.sh b/cloudbuild/new-distro-detector/run.sh index 5e1867ac09..ce0f500576 100644 --- a/cloudbuild/new-distro-detector/run.sh +++ b/cloudbuild/new-distro-detector/run.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # See go/sdi-new-distro-detector for details on how this script is being used. # A short summary is that it is run periodically by GCB to file bugs when diff --git a/cmd/agent_wrapper/main_test.go b/cmd/agent_wrapper/main_test.go index a9e06f5a3c..b333b42327 100644 --- a/cmd/agent_wrapper/main_test.go +++ b/cmd/agent_wrapper/main_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/confgenerator/feature_tracking_internal_test.go b/confgenerator/feature_tracking_internal_test.go index 66420f7f49..37392dbc8a 100644 --- a/confgenerator/feature_tracking_internal_test.go +++ b/confgenerator/feature_tracking_internal_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package confgenerator import ( diff --git a/dev-docs/makefile.md b/dev-docs/makefile.md index f5ad081ff6..a2cccca1e7 100644 --- a/dev-docs/makefile.md +++ b/dev-docs/makefile.md @@ -6,6 +6,10 @@ The Makefile `tasks.mak` is a Makefile for the project that is used to quickly p We are unable to use the actual `Makefile` name in this repo; because we build the Ops Agent into a deb package, `debhelper` tries to autodetect `make` as the build system in most of its `dh_auto` steps. We do not want `debhelper` to pick up the Makfile and try picking up different targets to build and test it. +## Disclaimer + +`tasks.mak` is provided without any guarantees or warranty on its targets. It is meant purely for developer convenience, and it is advised not to make any dependency on the targets since they are subject to change at any time. + ## Usage For convenience it helps to make a symlink from `Makefile` to `tasks.mak` . There is a target to do this, to run it: @@ -13,7 +17,7 @@ For convenience it helps to make a symlink from `Makefile` to `tasks.mak` . Ther make -f tasks.mak makefile_symlink ``` -Now you can call the targets simply with the `make` command without needing to specify the `tasks.mak` file. The file `Makefile` is gitignored, since we don't want to push it to the repo for the reasons stated in the previous section. +Now you can call the targets simply with the `make` command without needing to specify the `tasks.mak` file. The file `Makefile` is gitignored, since we don't want to push it to the repo for the reasons stated in the previous section. To run something from the Makefile, you will need to give `make` the `-f` (file) flag with a path to `tasks.mak`. For example, to run the `test` target: ``` @@ -35,8 +39,4 @@ A new target should be added to `tasks.mak` if: * There's a new package with Unit Tests * There is something that developers may need to run often, especially if it's a complicated command * There are new tasks to run in CI -* There is a new development tool to be installed and used - -## Disclaimer - -`tasks.mak` is provided without any guarantees or warranty on its targets. It is meant purely for developer convenience, and it is advised not to make any dependency on the targets since they are subject to change at any time. \ No newline at end of file +* There is a new development tool to be installed and used diff --git a/dev-docs/transformation-tests.md b/dev-docs/transformation-tests.md new file mode 100644 index 0000000000..11fe8e2776 --- /dev/null +++ b/dev-docs/transformation-tests.md @@ -0,0 +1,51 @@ +# Transformation Tests + +The transformation tests are tests that will run Fluent Bit and OpenTelemetry Operations Collector (otelopscol) directly in your environment and verify the results of various logging operations by reading their output from stdout and stderr. This is to check the correctness of log parsing expectations in a more lightweight way than full integration tests. + +## Makefile Usage + +NOTE: It is assumed that you have followed the [makefile setup instructions](./makefile.md#usage). + +For your convenience, there is a Makefile target to run transformation tests: +```bash +make transformation_test +``` +You can also update the transformation test goldens: +```bash +make transformation_test_update +``` +These targets are part of the `precommit` and `precommit_update` targets respectively. + +If you are on a new branch that updates Fluent Bit or otelopscol and are locally verifying the transformation tests, you can force the agents to rebuild by deleting the `dist` folder before running `make transfomration_test`; the target will rebuild the agents if they are not present. + +Read on if you are interested in how the transformation tests actually work. + +## Usage + +The transformation tests take paths to Fluent Bit and otelopscol binaries to execute directly and compare expected output. To run the tests, first you will need to build both binaries. Use the build scripts to build each agent and install them into the `dist` folder: +```bash +sh ./builds/fluent_bit.sh $(pwd)/dist +SKIP_OTEL_JAVA=true sh ./builds/otel.sh $(pwd)/dist +``` +After running each script, you will have a `dist` folder that contains both agents within the full install directory. (Note that these instructions will not build OTel Java; if that is needed, do not pass `SKIP_OTEL_JAVA`). + +The paths to each can passed into the test using environment variables or flags. +```bash +go test ./transformation_test \ +-flb=${PWD}/dist/opt/google-cloud-ops-agent/subagents/fluent-bit/bin/fluent-bit \ +-otelopscol=${PWD}/dist/opt/google-cloud-ops-agent/subagents/opentelemetry-collector/otelopscol +``` +or +```bash +FLB=${PWD}/dist/opt/google-cloud-ops-agent/subagents/fluent-bit/bin/fluent-bit \ +OTELOPSCOL=${PWD}/dist/opt/google-cloud-ops-agent/subagents/opentelemetry-collector/otelopscol \ +go test ./transformation_test +``` + +If you have updated the fluent-bit or otelopscol submodules and need to update the golden testdata, you can add the `-update` flag to the test. +```bash +FLB=${PWD}/dist/opt/google-cloud-ops-agent/subagents/fluent-bit/bin/fluent-bit \ +OTELOPSCOL=${PWD}/dist/opt/google-cloud-ops-agent/subagents/opentelemetry-collector/otelopscol \ +go test ./transformation_test -update +``` +(Note: the `-update` flag belongs to the test, not to `go test`. The flag must go after the specified package, not before.) diff --git a/dockerfiles/compile_test.go b/dockerfiles/compile_test.go index 717b14f958..a05f8984ac 100644 --- a/dockerfiles/compile_test.go +++ b/dockerfiles/compile_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/integration_test/gce/zone_picker.go b/integration_test/gce/zone_picker.go index 9fccb6c98a..73086110dc 100644 --- a/integration_test/gce/zone_picker.go +++ b/integration_test/gce/zone_picker.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package gce import ( diff --git a/integration_test/mirror_content.sh b/integration_test/mirror_content.sh index cb13f1c170..3423e2d1fb 100755 --- a/integration_test/mirror_content.sh +++ b/integration_test/mirror_content.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + USAGE="Usage: ./mirror_content.sh [URL]... diff --git a/integration_test/third_party_apps_test/applications/couchbase/features.yaml b/integration_test/third_party_apps_test/applications/couchbase/features.yaml index b502a5209c..d9e1eff38f 100644 --- a/integration_test/third_party_apps_test/applications/couchbase/features.yaml +++ b/integration_test/third_party_apps_test/applications/couchbase/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:couchbase module: metrics diff --git a/integration_test/third_party_apps_test/applications/couchdb/features.yaml b/integration_test/third_party_apps_test/applications/couchdb/features.yaml index 175d8c274d..f3d3d72be8 100644 --- a/integration_test/third_party_apps_test/applications/couchdb/features.yaml +++ b/integration_test/third_party_apps_test/applications/couchdb/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:couchdb module: metrics diff --git a/integration_test/third_party_apps_test/applications/elasticsearch/features.yaml b/integration_test/third_party_apps_test/applications/elasticsearch/features.yaml index 3d0d0155c3..874bde098b 100644 --- a/integration_test/third_party_apps_test/applications/elasticsearch/features.yaml +++ b/integration_test/third_party_apps_test/applications/elasticsearch/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:elasticsearch module: metrics diff --git a/integration_test/third_party_apps_test/applications/flink/features.yaml b/integration_test/third_party_apps_test/applications/flink/features.yaml index 728159c229..86773b158d 100644 --- a/integration_test/third_party_apps_test/applications/flink/features.yaml +++ b/integration_test/third_party_apps_test/applications/flink/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:flink module: metrics diff --git a/integration_test/third_party_apps_test/applications/hadoop/features.yaml b/integration_test/third_party_apps_test/applications/hadoop/features.yaml index 71eb00a2ab..5296b3c426 100644 --- a/integration_test/third_party_apps_test/applications/hadoop/features.yaml +++ b/integration_test/third_party_apps_test/applications/hadoop/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:hadoop module: metrics diff --git a/integration_test/third_party_apps_test/applications/hbase/features.yaml b/integration_test/third_party_apps_test/applications/hbase/features.yaml index 81cdd64013..3b79dfd1bf 100644 --- a/integration_test/third_party_apps_test/applications/hbase/features.yaml +++ b/integration_test/third_party_apps_test/applications/hbase/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:hbase module: metrics diff --git a/integration_test/third_party_apps_test/applications/iis/features.yaml b/integration_test/third_party_apps_test/applications/iis/features.yaml index 1babc9b15c..e38549fecb 100644 --- a/integration_test/third_party_apps_test/applications/iis/features.yaml +++ b/integration_test/third_party_apps_test/applications/iis/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:iis module: metrics diff --git a/integration_test/third_party_apps_test/applications/jetty/features.yaml b/integration_test/third_party_apps_test/applications/jetty/features.yaml index 6e704b99f1..5d37c85cee 100644 --- a/integration_test/third_party_apps_test/applications/jetty/features.yaml +++ b/integration_test/third_party_apps_test/applications/jetty/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:jetty module: metrics diff --git a/integration_test/third_party_apps_test/applications/jvm/features.yaml b/integration_test/third_party_apps_test/applications/jvm/features.yaml index 659fafd3bf..4484271b35 100644 --- a/integration_test/third_party_apps_test/applications/jvm/features.yaml +++ b/integration_test/third_party_apps_test/applications/jvm/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:jvm module: metrics diff --git a/integration_test/third_party_apps_test/applications/kafka/features.yaml b/integration_test/third_party_apps_test/applications/kafka/features.yaml index 0645ba3230..9fc1ff1b54 100644 --- a/integration_test/third_party_apps_test/applications/kafka/features.yaml +++ b/integration_test/third_party_apps_test/applications/kafka/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:kafka module: metrics diff --git a/integration_test/third_party_apps_test/applications/mariadb/features.yaml b/integration_test/third_party_apps_test/applications/mariadb/features.yaml index ac777917e4..e9819a57ca 100644 --- a/integration_test/third_party_apps_test/applications/mariadb/features.yaml +++ b/integration_test/third_party_apps_test/applications/mariadb/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:mysql module: metrics diff --git a/integration_test/third_party_apps_test/applications/memcached/features.yaml b/integration_test/third_party_apps_test/applications/memcached/features.yaml index a9753a65c0..18f9f33869 100644 --- a/integration_test/third_party_apps_test/applications/memcached/features.yaml +++ b/integration_test/third_party_apps_test/applications/memcached/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:memcached module: metrics diff --git a/integration_test/third_party_apps_test/applications/mongodb/features.yaml b/integration_test/third_party_apps_test/applications/mongodb/features.yaml index 1b32f4eee7..fcd341db0c 100644 --- a/integration_test/third_party_apps_test/applications/mongodb/features.yaml +++ b/integration_test/third_party_apps_test/applications/mongodb/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:mongodb module: metrics diff --git a/integration_test/third_party_apps_test/applications/mongodb3.6/features.yaml b/integration_test/third_party_apps_test/applications/mongodb3.6/features.yaml index 23f5ce211f..5423f6f0ce 100644 --- a/integration_test/third_party_apps_test/applications/mongodb3.6/features.yaml +++ b/integration_test/third_party_apps_test/applications/mongodb3.6/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:mongodb module: metrics diff --git a/integration_test/third_party_apps_test/applications/mssql/features.yaml b/integration_test/third_party_apps_test/applications/mssql/features.yaml index 31bff394b7..8d2f0bf2f7 100644 --- a/integration_test/third_party_apps_test/applications/mssql/features.yaml +++ b/integration_test/third_party_apps_test/applications/mssql/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:mssql module: metrics diff --git a/integration_test/third_party_apps_test/applications/mysql/features.yaml b/integration_test/third_party_apps_test/applications/mysql/features.yaml index ac777917e4..e9819a57ca 100644 --- a/integration_test/third_party_apps_test/applications/mysql/features.yaml +++ b/integration_test/third_party_apps_test/applications/mysql/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:mysql module: metrics diff --git a/integration_test/third_party_apps_test/applications/mysql5.7/features.yaml b/integration_test/third_party_apps_test/applications/mysql5.7/features.yaml index ac777917e4..e9819a57ca 100644 --- a/integration_test/third_party_apps_test/applications/mysql5.7/features.yaml +++ b/integration_test/third_party_apps_test/applications/mysql5.7/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:mysql module: metrics diff --git a/integration_test/third_party_apps_test/applications/nginx/features.yaml b/integration_test/third_party_apps_test/applications/nginx/features.yaml index 9b9693db79..da82bf9678 100644 --- a/integration_test/third_party_apps_test/applications/nginx/features.yaml +++ b/integration_test/third_party_apps_test/applications/nginx/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:nginx module: metrics diff --git a/integration_test/third_party_apps_test/applications/oracledb/features.yaml b/integration_test/third_party_apps_test/applications/oracledb/features.yaml index 87fb23ae62..4c8f33807d 100644 --- a/integration_test/third_party_apps_test/applications/oracledb/features.yaml +++ b/integration_test/third_party_apps_test/applications/oracledb/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:oracledb module: metrics diff --git a/integration_test/third_party_apps_test/applications/postgresql/features.yaml b/integration_test/third_party_apps_test/applications/postgresql/features.yaml index 4cd7253876..628ca219e1 100644 --- a/integration_test/third_party_apps_test/applications/postgresql/features.yaml +++ b/integration_test/third_party_apps_test/applications/postgresql/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:postgresql module: metrics diff --git a/integration_test/third_party_apps_test/applications/rabbitmq/features.yaml b/integration_test/third_party_apps_test/applications/rabbitmq/features.yaml index 97e5ec5844..059534a878 100644 --- a/integration_test/third_party_apps_test/applications/rabbitmq/features.yaml +++ b/integration_test/third_party_apps_test/applications/rabbitmq/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:rabbitmq module: metrics diff --git a/integration_test/third_party_apps_test/applications/redis/features.yaml b/integration_test/third_party_apps_test/applications/redis/features.yaml index 3da64985cb..1ba2938b1f 100644 --- a/integration_test/third_party_apps_test/applications/redis/features.yaml +++ b/integration_test/third_party_apps_test/applications/redis/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:redis module: metrics diff --git a/integration_test/third_party_apps_test/applications/solr/features.yaml b/integration_test/third_party_apps_test/applications/solr/features.yaml index 85ac96cc18..3cb3487c0a 100644 --- a/integration_test/third_party_apps_test/applications/solr/features.yaml +++ b/integration_test/third_party_apps_test/applications/solr/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:solr module: metrics diff --git a/integration_test/third_party_apps_test/applications/tomcat/features.yaml b/integration_test/third_party_apps_test/applications/tomcat/features.yaml index d863fe45cc..4f83f20cf1 100644 --- a/integration_test/third_party_apps_test/applications/tomcat/features.yaml +++ b/integration_test/third_party_apps_test/applications/tomcat/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:tomcat module: metrics diff --git a/integration_test/third_party_apps_test/applications/varnish/features.yaml b/integration_test/third_party_apps_test/applications/varnish/features.yaml index a562930663..ee7d44f2b9 100644 --- a/integration_test/third_party_apps_test/applications/varnish/features.yaml +++ b/integration_test/third_party_apps_test/applications/varnish/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:varnish module: metrics diff --git a/integration_test/third_party_apps_test/applications/vault/features.yaml b/integration_test/third_party_apps_test/applications/vault/features.yaml index a8131f2922..8da5e74fbb 100644 --- a/integration_test/third_party_apps_test/applications/vault/features.yaml +++ b/integration_test/third_party_apps_test/applications/vault/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:vault module: metrics diff --git a/integration_test/third_party_apps_test/applications/wildfly/features.yaml b/integration_test/third_party_apps_test/applications/wildfly/features.yaml index 1ef209b213..55fb00a978 100644 --- a/integration_test/third_party_apps_test/applications/wildfly/features.yaml +++ b/integration_test/third_party_apps_test/applications/wildfly/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:wildfly module: metrics diff --git a/integration_test/third_party_apps_test/applications/zookeeper/features.yaml b/integration_test/third_party_apps_test/applications/zookeeper/features.yaml index 4cdd8adaee..f7d53538aa 100644 --- a/integration_test/third_party_apps_test/applications/zookeeper/features.yaml +++ b/integration_test/third_party_apps_test/applications/zookeeper/features.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + features: - feature: receivers:zookeeper module: metrics diff --git a/internal/secret/string_test.go b/internal/secret/string_test.go index 8d87dd30bc..a33dddfe6b 100644 --- a/internal/secret/string_test.go +++ b/internal/secret/string_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package secret_test import ( diff --git a/kokoro/scripts/test/build_container.yaml b/kokoro/scripts/test/build_container.yaml index 468c009ea7..a41f659033 100644 --- a/kokoro/scripts/test/build_container.yaml +++ b/kokoro/scripts/test/build_container.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # This is triggered on every push to master and builds/pushes go_test.Dockerfile. steps: - name: gcr.io/google.com/cloudsdktool/google-cloud-cli diff --git a/kokoro/scripts/test/go_test.Dockerfile b/kokoro/scripts/test/go_test.Dockerfile index 3a7b56e795..516778ac35 100644 --- a/kokoro/scripts/test/go_test.Dockerfile +++ b/kokoro/scripts/test/go_test.Dockerfile @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # To edit this file, follow these instructions: go/sdi-integ-test#updating-the-test-runner-container. FROM golang:1.22-bullseye diff --git a/kokoro/scripts/test/start_soak_test.sh b/kokoro/scripts/test/start_soak_test.sh index 601dbe02f7..2fa8850b5d 100644 --- a/kokoro/scripts/test/start_soak_test.sh +++ b/kokoro/scripts/test/start_soak_test.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -e set -u diff --git a/project.yaml b/project.yaml index 63a156e498..72be1413ae 100644 --- a/project.yaml +++ b/project.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + targets: oracular: package_extension: diff --git a/tasks.mak b/tasks.mak index 563c4c6e55..562b2b00ff 100644 --- a/tasks.mak +++ b/tasks.mak @@ -20,9 +20,11 @@ # Setup ############ +.PHONY: makefile_symlink makefile_symlink: ln -s tasks.mak Makefile +.PHONY: install_tools install_tools: go install github.com/google/yamlfmt/cmd/yamlfmt@latest go install github.com/google/addlicense@master @@ -31,32 +33,46 @@ install_tools: # Build ############ +.PHONY: build build: cd submodules/fluent-bit/build && find . ! -name ".empty" -type f -delete mkdir -p /tmp/google-cloud-ops-agent DOCKER_BUILDKIT=1 docker build -o /tmp/google-cloud-ops-agent . $(ARGS) +.PHONY: fluent_bit_local +fluent_bit_local: + bash ./builds/fluent_bit.sh $(PWD)/dist + +SKIP_JAVA ?= true +.PHONY: otelopscol_local +otelopscol_local: + SKIP_OTEL_JAVA=${SKIP_JAVA} bash ./builds/otel.sh $(PWD)/dist + ############ # Tools ############ +.PHONY: addlicense addlicense: addlicense -ignore "submodules/**" -ignore "**/testdata/**" -ignore "**/built-in-config*" -c "Google LLC" -l apache . +.PHONY: addlicense_check addlicense_check: addlicense -check -ignore "submodules/**" -ignore "**/testdata/**" -ignore "**/built-in-config*" -c "Google LLC" -l apache . -# Originally I made the argument to this "PATH" but of course that messes with -# the PATH environment variable. :D +.PHONY: addlicense_to addlicense_to: - addlicense -c "Google LLC" -l apache $(P) + addlicense -c "Google LLC" -l apache $(FILE) +.PHONY: yaml_format yaml_format: yamlfmt +.PHONY: yaml_lint yaml_lint: yamlfmt -lint +.PHONY: compile_dockerfile compile_dockerfile: go run ./dockerfiles @@ -64,15 +80,27 @@ compile_dockerfile: # Unit Tests ############ +.PHONY: test test: go test ./... -test_confgenerator_update: - go test ./confgenerator -update +.PHONY: test_confgenerator +test_confgenerator: + go test ./confgenerator $(if $(UPDATE),-update,) + +.PHONY: test_confgenerator_update +test_confgenerator_update: UPDATE=true +test_confgenerator_update: test_confgenerator + +.PHONY: test_metadata +test_metadata: + go test ./integration_test/metadata $(if $(UPDATE),-update,) -test_metadata_update: - go test ./integration_test/metadata -update +.PHONY: test_metadata_update +test_metadata_update: UPDATE=true +test_metadata_update: test_metadata +.PHONY: new_confgenerator_test new_confgenerator_test: ifndef TEST_NAME $(error "Please provide a TEST_NAME argument") @@ -81,6 +109,22 @@ endif mkdir -p ./confgenerator/testdata/goldens/$(TEST_NAME)/golden touch ./confgenerator/testdata/goldens/$(TEST_NAME)/input.yaml +dist/opt/google-cloud-ops-agent/subagents/fluent-bit/bin/fluent-bit: + $(MAKE) fluent_bit_local + +dist/opt/google-cloud-ops-agent/subagents/opentelemetry-collector/otelopscol: + $(MAKE) otelopscol_local + +.PHONY: transformation_test +transformation_test: dist/opt/google-cloud-ops-agent/subagents/fluent-bit/bin/fluent-bit dist/opt/google-cloud-ops-agent/subagents/opentelemetry-collector/otelopscol + FLB=$(PWD)/dist/opt/google-cloud-ops-agent/subagents/fluent-bit/bin/fluent-bit \ + OTELOPSCOL=$(PWD)/dist/opt/google-cloud-ops-agent/subagents/opentelemetry-collector/otelopscol \ + go test ./transformation_test $(if $(UPDATE),-update,) + +.PHONY: transformation_test_update +transformation_test_update: UPDATE=true +transformation_test_update: transformation_test + ############ # Integration Tests ############ @@ -96,6 +140,7 @@ endif ZONES ?= us-central1-b PLATFORMS ?= debian-cloud:debian-11 +.PHONY: integration_tests integration_tests: ZONES="${ZONES}" \ PLATFORMS="${PLATFORMS}" \ @@ -104,6 +149,7 @@ integration_tests: -tags=integration_test \ -timeout=4h +.PHONY: third_party_apps_test third_party_apps_test: ZONES="${ZONES}" \ PLATFORMS="${PLATFORMS}" \ @@ -116,27 +162,33 @@ third_party_apps_test: # Precommit ############ -precommit: addlicense_check test go_vet +.PHONY: precommit +precommit: addlicense_check go_vet test transformation_test -precommit_update: addlicense test_confgenerator_update test_metadata_update test go_vet +.PHONY: precommit_update +precommit_update: addlicense go_vet test_confgenerator_update test_metadata_update test transformation_test_update ############ # Convenience ############ +.PHONY: reset_submodules reset_submodules: git submodule foreach --recursive git clean -xfd git submodule foreach --recursive git reset --hard git submodule update --init --recursive +.PHONY: sync_fork sync_fork: git fetch upstream git rebase upstream/main git push -f +.PHONY: update_go_modules update_go_modules: go get -t -u ./... +.PHONY: go_vet go_vet: go list ./... | grep -v "generated" | grep -v "/vendor/" | xargs go vet GOOS=windows go list ./... | grep -v "generated" | grep -v "/vendor/" | GOOS=windows xargs go vet diff --git a/transformation_test/transformation_test.go b/transformation_test/transformation_test.go index 1e593c7b22..34e5abb37a 100644 --- a/transformation_test/transformation_test.go +++ b/transformation_test/transformation_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package transformation_test import ( @@ -115,7 +129,7 @@ func (transformationConfig transformationTest) runFluentBitTest(t *testing.T, na // Start Fluent-bit cmd := exec.Command( - fmt.Sprintf("%s", *flbPath), + *flbPath, "-v", fmt.Sprintf("--config=%s", filepath.Join(tempPath, flbMainConf)), fmt.Sprintf("--parser=%s", filepath.Join(filepath.Join(tempPath, flbParserConf)))) @@ -305,14 +319,14 @@ func (transformationConfig transformationTest) generateOTelConfig(ctx context.Co "input": rp[0], }, Pipelines: map[string]otel.Pipeline{ - "input": otel.Pipeline{ + "input": { Type: "logs", ReceiverPipelineName: "input", Processors: components, }, }, Exporters: map[otel.ExporterType]otel.Component{ - otel.OTel: otel.Component{ + otel.OTel: { Type: "googlecloud", Config: map[string]any{ "project": "my-project", @@ -408,7 +422,7 @@ func (transformationConfig transformationTest) runOTelTestInner(t *testing.T, na // Start otelopscol cmd := exec.Command( - fmt.Sprintf("%s", *otelopscolPath), + *otelopscolPath, "--config=env:OTELOPSCOL_CONFIG", ) cmd.Env = append(os.Environ(), @@ -491,12 +505,13 @@ func (transformationConfig transformationTest) runOTelTestInner(t *testing.T, na } return nil }) - var exit_error string + + var exitErr error // Wait for the process to exit. eg.Go(func() error { if err := cmd.Wait(); err != nil { - if err, ok := err.(*exec.ExitError); ok { - exit_error = err.String() + if _, ok := err.(*exec.ExitError); ok { + exitErr = err t.Logf("process terminated with error: %v", err) } else { return fmt.Errorf("process failed: %w", err) @@ -511,8 +526,8 @@ func (transformationConfig transformationTest) runOTelTestInner(t *testing.T, na } // Package up errors to be included in the golden output. - if exit_error != "" { - got = append(got, map[string]any{"exit_error": exit_error}) + if exitErr != nil { + got = append(got, map[string]any{"exit_error": exitErr.Error()}) } if len(errors) != 0 { got = append(got, map[string]any{"collector_errors": errors})