Skip to content

Regression Testing Operator Integration #101

Regression Testing Operator Integration

Regression Testing Operator Integration #101

name: Regression Testing Operator Integration
on:
workflow_dispatch:
env:
AGENT_TESTS: java
#go dotnet --- both pending // python nodejs
permissions:
contents: read
jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Kind cluster and local Docker registry
run:
bash test/operator/kind-with-registry.sh
- name: Collector
run: |
docker network create elastic
#Local elasticsearch without SSL so http://9200
docker run --name es01 --net elastic -p 9200:9200 -m 1GB -e xpack.security.enabled=false -e xpack.security.enrollment.enabled=false -e discovery.type=single-node docker.elastic.co/elasticsearch/elasticsearch:8.16.0 1>es.log 2>&1 &
#Elastic agent from download instructions
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.16.0-linux-x86_64.tar.gz
tar xzvf elastic-agent-8.16.0-linux-x86_64.tar.gz
cd elastic-agent-8.16.0-linux-x86_64/
#Collector confg for elastic agent
curl -L -O https://raw.githubusercontent.com/elastic/elastic-agent/refs/heads/main/internal/pkg/otel/samples/linux/logs_metrics_traces.yml
export STORAGE_DIR=/var/tmp
export ELASTIC_ENDPOINT=https://localhost:9200
export ELASTIC_API_KEY=nothing
sudo -E ./elastic-agent otel --config logs_metrics_traces.yml 1>collector.log 2>&1 &
cat es.log
#Will fail as that script missing
bash ../test/operator/wait_for_elasticsearch_start.sh collector.log "elastic agent collector" "Everything is ready"
- name: Create Test Images
run: |
for t in ${AGENT_TESTS[@]}
do
echo "Creating image for $t"
docker build -t $t-test-app test/operator/$t
docker tag $t-test-app localhost:5001/registry/$t-test-app
docker push localhost:5001/registry/$t-test-app
done
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.11.2
- name: Install Operator
run: |
bash test/operator/match_and_execute.sh "kubectl create namespace opentelemetry-operator-system"
bash test/operator/match_and_execute.sh "helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts"
helm repo update
bash test/operator/match_and_execute.sh "helm upgrade --install --namespace opentelemetry-operator-system opentelemetry-kube-stack open-telemetry/opentelemetry-kube-stack --values 'https://raw.githubusercontent.com/elastic/opentelemetry/refs/heads/8.16/resources/kubernetes/operator/helm/values.yaml' --version 0.3.3"
bash test/operator/wait_for_pod_start.sh opentelemetry-operator-system opentelemetry-operator 2/2 1
kubectl get pods -A
- name: Start And Test Collector Skeleton
run: |
echo "Nothing here yet"
- name: Start Test Images
run: |
kubectl create namespace banana
for t in ${AGENT_TESTS[@]}
do
if [ "x$t" = "xgo" ]; then CONTAINER_READY="2/2"; else CONTAINER_READY="1/1"; fi
AGENT_START_GREP=`grep -A1 AGENT_HAS_STARTED_IF_YOU_SEE test/operator/$t/test-app.yaml | perl -ne '/value:\s*"(.*)"/ && print "$1\n"'`
echo "Starting pod for $t"
kubectl create -f test/operator/$t/test-app.yaml
bash test/operator/wait_for_pod_start.sh banana $t-test-app $CONTAINER_READY 1
bash test/operator/wait_for_agent_start.sh banana $t-test-app "$AGENT_START_GREP"
kubectl delete -f test/operator/$t/test-app.yaml
done