Skip to content

Commit

Permalink
E2E Testing Environment for Kpt Live Tests (#1492)
Browse files Browse the repository at this point in the history
* run live e2e tests in GitHub Actions
  • Loading branch information
runewake2 committed Feb 26, 2021
1 parent 70056fc commit a1679f7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/e2eEnvironment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Kpt Live - KinD Tests"
on:
- workflow_dispatch

jobs:
kind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
# Pinned to Commit to ensure action is consistent: https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
# If you upgrade this version confirm the changes match your expectations
- uses: engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 # v0.5.0
with:
version: "v0.9.0"
skipClusterCreation: true
- name: Run Tests
run: |
./e2e/live/end-to-end-test.sh
11 changes: 11 additions & 0 deletions e2e/live/end-to-end-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ BUILD_DEPS_AT_HEAD=""
# Default Kubernetes cluster version to run test against.
K8S_VERSION=${DEFAULT_K8S_VERSION}

HAS_TEST_FAILURE=0

# Parse/validate parameters
options="bk:"
while getopts $options opt; do
Expand Down Expand Up @@ -225,6 +227,7 @@ function assertContains {
touch $OUTPUT_DIR/errors
fi
echo "error: expected missing text \"${test_arg}\"" >> $OUTPUT_DIR/errors
HAS_TEST_FAILURE=1
fi
}

Expand All @@ -242,6 +245,7 @@ function assertNotContains {
touch $OUTPUT_DIR/errors
fi
echo "error: unexpected text \"${test_arg}\" found" >> $OUTPUT_DIR/errors
HAS_TEST_FAILURE=1
fi
}

Expand All @@ -265,6 +269,7 @@ function assertCMInventory {
touch $OUTPUT_DIR/errors
fi
echo "error: expected missing ConfigMap inventory object in ${ns} namespace" >> $OUTPUT_DIR/errors
HAS_TEST_FAILURE=1
fi

test 1 == $(grep $numInv $OUTPUT_DIR/numinv | wc -l);
Expand All @@ -276,6 +281,7 @@ function assertCMInventory {
touch $OUTPUT_DIR/errors
fi
echo "error: expected ConfigMap inventory to have $numInv inventory items" >> $OUTPUT_DIR/errors
HAS_TEST_FAILURE=1
fi
}

Expand All @@ -296,6 +302,7 @@ function assertRGInventory {
touch $OUTPUT_DIR/errors
fi
echo "error: expected missing ResourceGroup inventory in ${ns} namespace" >> $OUTPUT_DIR/errors
HAS_TEST_FAILURE=1
fi
}

Expand All @@ -318,6 +325,7 @@ function assertPodExists {
touch $OUTPUT_DIR/errors
fi
echo "error: expected missing pod $namespace/$podName in ${namespace} namespace" >> $OUTPUT_DIR/errors
HAS_TEST_FAILURE=1
fi
}

Expand All @@ -340,6 +348,7 @@ function assertPodNotExists {
touch $OUTPUT_DIR/errors
fi
echo "error: unexpected pod $namespace/$podName found in ${namespace} namespace" >> $OUTPUT_DIR/errors
HAS_TEST_FAILURE=1
fi
}

Expand Down Expand Up @@ -920,3 +929,5 @@ echo "Cleaning up cluster"
kind delete cluster
echo "FINISHED"

# Return error code if tests have failed
exit $HAS_TEST_FAILURE

0 comments on commit a1679f7

Please sign in to comment.