Skip to content

Run etcd using tmpfs storage #70

Run etcd using tmpfs storage

Run etcd using tmpfs storage #70

Workflow file for this run

name: Test with Kind
on: push
env:
KIND_VERSION: v0.20.0
K8S_VERSION: v1.29.0
# Maximum time a dry run test should take to run in seconds
DRYRUN_THRESHOLD: 5
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Lint
run: |
gofmt -l -s $(find . -type f -name '*.go')
if [[ -n $(gofmt -l -s $(find . -type f -name '*.go')) ]]; then exit 1; fi
- name: Install kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Create tmpfs for etcd
run: |
sudo mkdir -p /tmp/etcd
sudo mount -t tmpfs tmpfs /tmp/etcd
- name: Create kind cluster
run: |
cat <<EOF | kind create cluster --image kindest/node:${K8S_VERSION} --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraMounts:
- containerPath: /var/lib/etcd
hostPath: /tmp/etcd
- role: worker
EOF
- name: Set up kubectl
run: |
kubectl cluster-info --context kind-kind
kubectl get nodes
- name: Build and test
run: |
make build
make test
- name: Dry run single focused test
run: |
bin/hydrophone --focus 'Simple pod should contain last line of the log' \
--output-dir ${{ github.workspace }}/dryrun_results/ \
--conformance-image registry.k8s.io/conformance:${K8S_VERSION} \
--dry-run | tee /tmp/dryrun.log
echo "DRYRUN_DURATION=$(grep -oP 'Ran 1 of \d+ Specs in \K[0-9.]+(?= seconds)' /tmp/dryrun.log | cut -d. -f1)" >> $GITHUB_ENV
- name: Check dry run duration
run: |
if [[ ${{ env.DRYRUN_DURATION }} -gt ${{ env.DRYRUN_THRESHOLD }} ]]; then
echo "Focused test took too long to run. Expected less than ${{ env.DRYRUN_THRESHOLD }} seconds, got ${{ env.DRYRUN_DURATION }} seconds"
exit 1
fi
- name: Wait for cleanup
timeout-minutes: 5
run: |
while kubectl get namespace conformance 2>/dev/null; do
echo "Waiting for conformance namespace to be deleted"
sleep 5
done
- name: Run a single focused test
run: |
bin/hydrophone --focus 'Simple pod should contain last line of the log' \
--output-dir ${{ github.workspace }}/results/ \
--conformance-image registry.k8s.io/conformance:${K8S_VERSION} | tee /tmp/test.log
echo "DURATION=$(grep -oP 'Ran 1 of \d+ Specs in \K[0-9.]+(?= seconds)' /tmp/test.log | cut -d. -f1)" >> $GITHUB_ENV
- name: Check duration
run: |
if [[ ${{ env.DURATION }} -lt ${{ env.DRYRUN_THRESHOLD }} ]]; then
echo "Focused test exited too quickly, check if dry-run is enabled. Expected more than ${{ env.DRYRUN_THRESHOLD }} seconds, got ${{ env.DURATION }} seconds"
exit 1
fi
- name: Archive conformance results
uses: actions/upload-artifact@v3
with:
name: conformance-results
path: ${{ github.workspace }}/results/