Skip to content

Commit

Permalink
implement workflow
Browse files Browse the repository at this point in the history
add org id

remove unused step

save output

fix

try again

fix

add tracetest cli step;

test

run other tests

add env id

upadte path

add variableset tests

fix

revert

run all suites;

test each feature individually

run all, one by one

disable

disable
  • Loading branch information
schoren committed Sep 19, 2024
1 parent 5a2f45c commit cec2915
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 12 deletions.
87 changes: 80 additions & 7 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
TRACETEST_LICENSE: ${{ secrets.TRACETEST_ONPREM_TEST_LICENSE }}
AGENT_API_KEY: ${{ secrets.AGENT_API_KEY }}
AGENT_ENV_ID: ${{ secrets.AGENT_ENV_ID }}
TESTS_REPO_DIR: "/tmp/tests"

steps:
- name: Checkout
Expand All @@ -18,21 +19,93 @@ jobs:
uses: helm/kind-action@v1
with:
cluster_name: tracetest
# install_only: true
install_only: true

- name: Test public images
run: |
kubectl config get-contexts
./scripts/setup_kind_cluster.sh --ci --build-deps --install-demo --force-setup
kind get kubeconfig --name tracetest > ~/.kube/config
helm install cloudagent -n default ./charts/tracetest-agent --set agent.apiKey="$AGENT_API_KEY" --set agent.environmentId="$AGENT_ENV_ID"
helm upgrade --install cloudagent ./charts/tracetest-agent \
-n default \
--set agent.apiKey="$AGENT_API_KEY" \
--set agent.environmentId="$AGENT_ENV_ID"
kubectl wait --for=condition=available --timeout=60s deployment/cloudagent-tracetest-agent
echo "Cloudagent deployed"
kubectl wait --for=condition=available --timeout=60s deployment/tt-tracetest-core-api
kubectl logs deployment/tt-tracetest-core-api
kubectl logs deployment/cloudagent-tracetest-agent
kubectl get cm tt-tracetest-core -o yaml
- name: Configure Custom DNS
run: |
# setup custom DNS resolve
sudo echo "127.0.0.1 tracetest.localdev" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 pokeshop.localdev" | sudo tee -a /etc/hosts
- name: Install Playwright
run: |
npx playwright install --with-deps
- name: Configure intial org and env
env:
TRACETEST_TEST_REPO_CLONE_PAT: ${{ secrets.TRACETEST_TEST_REPO_CLONE_PAT }}
TRACETEST_TEST_REPO: ${{ secrets.TRACETEST_TEST_REPO }}
GH_USERNAME: ${{ secrets.TRACETEST_USER_GH_USERNAME }}
GH_PASSWORD: ${{ secrets.TRACETEST_USER_GH_PASSWORD }}
GH_SECRET: ${{ secrets.TRACETEST_USER_GH_SECRET }}
TRACETEST_ENDPOINT: https://tracetest.localdev:30000/
OUTPUT_TOKEN_FILE: "/tmp/token.json"
run: |
BASEDIR=$(pwd)
# sparse checkout of the testing directory
git clone --depth 1 --filter=blob:none --sparse https://[email protected]/$TRACETEST_TEST_REPO.git $TESTS_REPO_DIR
cd $TESTS_REPO_DIR
git sparse-checkout init --cone
git sparse-checkout set testing
cd testing/e2e-tracetesting
npm install
npx playwright test tests/setup/extract-default-token.manual.ts --grep '@manual'
############################################
############################################
cd $BASEDIR
# run script for initial configuration
export VARS_TOKEN=$(cat $OUTPUT_TOKEN_FILE | jq -r '.token')
sed -i 's/%TOKEN_PLACEHOLDER%/'"$VARS_TOKEN"'/g' tests/vars/ci.yaml
export VARS_ORG_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.orgId')
sed -i 's/%ORG_ID_PLACEHOLDER%/'"$VARS_ORG_ID"'/g' tests/vars/ci.yaml
export VARS_ENV_ID=$(cat $OUTPUT_TOKEN_FILE | jq -r '.envId')
sed -i 's/%ENV_ID_PLACEHOLDER%/'"$VARS_ENV_ID"'/g' tests/vars/ci.yaml
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-output
path: /tmp/tests/

- name: Configure Tracetest CLI
uses: kubeshop/tracetest-github-action@v1
with:
token: ${{secrets.TRACETEST_CLI_TOKEN}}

- name: run tracetests
run: |
# tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features --vars ./tests/vars/ci.yaml
sleep 600
#tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/enviromment_tokens --vars ./tests/vars/ci.yaml
#tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environment_members --vars ./tests/vars/ci.yaml
tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/environments --vars ./tests/vars/ci.yaml
tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organization_invites --vars ./tests/vars/ci.yaml
tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/organizations --vars ./tests/vars/ci.yaml
tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/polling_profiles --vars ./tests/vars/ci.yaml
tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/tests --vars ./tests/vars/ci.yaml
tracetest run testsuite -f $TESTS_REPO_DIR/testing/server-tracetesting/features/variable_sets --vars ./tests/vars/ci.yaml
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/*/Chart.lock
**/*/charts/*
cluster.env
tracetest.kubeconfig
*.env
*tracetest.kubeconfig
*.bkp
3 changes: 3 additions & 0 deletions charts/tracetest-agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ spec:
imagePullPolicy: IfNotPresent

args: [
"--mode", "ci",
"-v",

{{- if .Values.agent.environmentId }}
"--environment",
"{{ .Values.agent.environmentId }}",
Expand Down
2 changes: 0 additions & 2 deletions kind-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ nodes:
- containerPort: 30000
hostPort: 30000
protocol: TCP
- role: worker
- role: worker
- role: worker
25 changes: 25 additions & 0 deletions tests/vars/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
type: VariableSet
spec:
id: helm-ci
name: Helm CI
values:
- key: BASE_URL
value: https://tracetest.localdev:30000
type: raw
- key: TOKEN
value: "%TOKEN_PLACEHOLDER%"
type: raw
- key: ORG_ID
value: "%ORG_ID_PLACEHOLDER%"
type: raw
- key: ENV_ID
value: "%ENV_ID_PLACEHOLDER%"
type: raw
- key: POKESHOP_URL
value: https://pokeshop.localdev:30000
type: raw
# This placeholder exists because when we try to run the tests testsuite,
# the cli will ask for the
- key: CREATED_TEST_ID
value: PLACEHOLDER
type: raw
5 changes: 4 additions & 1 deletion values-kind-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ traefik:

tracetest-core:
config:
collectorEndpoint: "cloudagent-tracetest-agent.default:4317"
telemetry:
enabled: true
collector:
endpoint: "cloudagent-tracetest-agent.default:4318"

0 comments on commit cec2915

Please sign in to comment.