Skip to content

Commit

Permalink
[CI] Rename test scripts (#2072)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm authored Sep 3, 2024
1 parent 8ca8a80 commit 8d47ba7
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 86 deletions.
26 changes: 13 additions & 13 deletions .buildkite/pipeline.trigger.integration.tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,36 +128,36 @@ done
done
popd > /dev/null

echo " - label: \":go: Integration test: build-zip\""
# TODO: Missing docker & docker-compose in MACOS ARM agent image, skip installation of packages in the meantime.
# If docker and docker-compose are available for this platform/architecture, it could be added a step to test the stack commands (or even replace this one).
echo " - label: \":macos: :go: Integration test: build-zip\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-build-zip"
echo " agents:"
echo " provider: \"gcp\""
echo " image: \"${UBUNTU_X86_64_AGENT_IMAGE}\""
echo " provider: \"orka\""
echo " imagePrefix: \"${MACOS_ARM_AGENT_IMAGE}\""
echo " artifact_paths:"
echo " - build/elastic-stack-dump/build-zip/logs/*.log"
echo " - build/packages/*.sig"

# TODO: Missing docker & docker-compose in MACOS ARM agent image, skip installation of packages in the meantime.
# If docker and docker-compose are available for this platform/architecture, it could be added a step to test the stack commands (or even replace this one).
echo " - label: \":macos: :go: Integration test: build-zip\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-just-build-zip"
echo " - label: \":go: Integration test: build-install-zip\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-build-install-zip"
echo " agents:"
echo " provider: \"orka\""
echo " imagePrefix: \"${MACOS_ARM_AGENT_IMAGE}\""
echo " provider: \"gcp\""
echo " image: \"${UBUNTU_X86_64_AGENT_IMAGE}\""
echo " artifact_paths:"
echo " - build/elastic-stack-dump/build-zip/logs/*.log"
echo " - build/packages/*.sig"

echo " - label: \":go: Integration test: install-zip\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-install-zip"
echo " - label: \":go: Integration test: build-install-zip-file\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-build-install-zip-file"
echo " agents:"
echo " provider: \"gcp\""
echo " image: \"${UBUNTU_X86_64_AGENT_IMAGE}\""
echo " artifact_paths:"
echo " - build/elastic-stack-dump/install-zip/logs/*.log"

echo " - label: \":go: Integration test: install-zip-shellinit\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-install-zip-shellinit"
echo " - label: \":go: Integration test: build-install-zip-file-shellinit\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-build-install-zip-file-shellinit"
echo " agents:"
echo " provider: \"gcp\""
echo " image: \"${UBUNTU_X86_64_AGENT_IMAGE}\""
Expand Down
11 changes: 4 additions & 7 deletions .buildkite/scripts/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PARALLEL_TARGET="test-check-packages-parallel"
FALSE_POSITIVES_TARGET="test-check-packages-false-positives"
KIND_TARGET="test-check-packages-with-kind"
SYSTEM_TEST_FLAGS_TARGET="test-system-test-flags"
TEST_JUST_BUILD_ZIP_TARGET="test-just-build-zip"
TEST_BUILD_ZIP_TARGET="test-build-zip"

GOOGLE_CREDENTIALS_FILENAME="google-cloud-credentials.json"

Expand Down Expand Up @@ -82,7 +82,7 @@ if [[ "$SERVERLESS" == "false" ]]; then
echo "--- install go"
with_go

if [[ "${TARGET}" != "${TEST_JUST_BUILD_ZIP_TARGET}" ]]; then
if [[ "${TARGET}" != "${TEST_BUILD_ZIP_TARGET}" ]]; then
# Not supported in Macos ARM
echo "--- install docker"
with_docker
Expand All @@ -92,11 +92,8 @@ if [[ "$SERVERLESS" == "false" ]]; then
fi
fi

if [[ "${TARGET}" == "${FALSE_POSITIVES_TARGET}" ]]; then
# just required for now while testing false positive targets
echo "--- install yq"
with_yq
fi
echo "--- install yq"
with_yq

if [[ "${TARGET}" == "${KIND_TARGET}" || "${TARGET}" == "${SYSTEM_TEST_FLAGS_TARGET}" ]]; then
echo "--- install kubectl & kind"
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ test-check-packages-with-custom-agent:
test-build-zip:
./scripts/test-build-zip.sh

test-just-build-zip:
./scripts/test-just-build-zip.sh
test-build-install-zip:
./scripts/test-build-install-zip.sh

test-install-zip:
./scripts/test-install-zip.sh
test-build-install-zip-file:
./scripts/test-build-install-zip-file.sh

test-install-zip-shellinit:
./scripts/test-install-zip.sh -s
test-build-install-zip-file-shellinit:
./scripts/test-build-install-zip-file.sh -s

test-system-test-flags:
./scripts/test-system-test-flags.sh
Expand All @@ -127,7 +127,7 @@ test-profiles-command:
test-check-update-version:
./scripts/test-check-update-version.sh

test: test-go test-stack-command test-check-packages test-profiles-command test-build-zip test-check-update-version
test: test-go test-stack-command test-check-packages test-profiles-command test-build-install-zip test-build-zip test-build-install-zip-file test-build-install-zip-file-shellinit test-check-update-version test-profiles-command test-system-test-flags

check-git-clean:
git update-index --really-refresh
Expand Down
File renamed without changes.
73 changes: 73 additions & 0 deletions scripts/test-build-install-zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash

set -euxo pipefail

cleanup() {
r=$?

# Dump stack logs
elastic-package stack dump -v --output build/elastic-stack-dump/build-zip

# Take down the stack
elastic-package stack down -v

# Clean used resources
for d in test/packages/*/*/; do
elastic-package clean -C "$d" -v
done

exit $r
}

testype() {
basename "$(dirname "$1")"
}

trap cleanup EXIT

OLDPWD=$PWD
# Build packages
export ELASTIC_PACKAGE_SIGNER_PRIVATE_KEYFILE="$OLDPWD/scripts/gpg-private.asc"
ELASTIC_PACKAGE_SIGNER_PASSPHRASE=$(cat "$OLDPWD/scripts/gpg-pass.txt")
export ELASTIC_PACKAGE_SIGNER_PASSPHRASE
ELASTIC_PACKAGE_LINKS_FILE_PATH="$(pwd)/scripts/links_table.yml"
export ELASTIC_PACKAGE_LINKS_FILE_PATH

go run ./scripts/gpgkey

for d in test/packages/*/*/; do
# Packages in false_positives can have issues.
if [ "$(testype $d)" == "false_positives" ]; then
continue
fi
elastic-package build -C "$d" --zip --sign -v
done

# Remove unzipped built packages, leave .zip files
rm -r build/packages/*/

# Boot up the stack
elastic-package stack up -d -v

eval "$(elastic-package stack shellinit)"

# Install packages from working copy
for d in test/packages/*/*/; do
# Packages in false_positives can have issues.
if [ "$(testype $d)" == "false_positives" ]; then
continue
fi
package_name=$(cat "${d}/manifest.yml" | yq -r .name)
package_version=$(cat "${d}/manifest.yml" | yq -r .version)
PACKAGE_NAME_VERSION="${package_name}-${package_version}"

elastic-package install -C "$d" -v

# check that the package is installed
curl -s \
-u "${ELASTIC_PACKAGE_ELASTICSEARCH_USERNAME}:${ELASTIC_PACKAGE_ELASTICSEARCH_PASSWORD}" \
--cacert "${ELASTIC_PACKAGE_CA_CERT}" \
-H 'content-type: application/json' \
-H 'kbn-xsrf: true' \
-f "${ELASTIC_PACKAGE_KIBANA_HOST}/api/fleet/epm/packages/${PACKAGE_NAME_VERSION}" | grep -q '"status":"installed"'
done
18 changes: 0 additions & 18 deletions scripts/test-build-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ set -euxo pipefail
cleanup() {
r=$?

# Dump stack logs
elastic-package stack dump -v --output build/elastic-stack-dump/build-zip

# Take down the stack
elastic-package stack down -v

# Clean used resources
for d in test/packages/*/*/; do
elastic-package clean -C "$d" -v
Expand Down Expand Up @@ -45,15 +39,3 @@ done

# Remove unzipped built packages, leave .zip files
rm -r build/packages/*/

# Boot up the stack
elastic-package stack up -d -v

# Install zipped packages
for d in test/packages/*/*/; do
# Packages in false_positives can have issues.
if [ "$(testype $d)" == "false_positives" ]; then
continue
fi
elastic-package install -C "$d" -v
done
41 changes: 0 additions & 41 deletions scripts/test-just-build-zip.sh

This file was deleted.

0 comments on commit 8d47ba7

Please sign in to comment.