Add unit tests #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
name: test | |
jobs: | |
test: | |
strategy: | |
matrix: | |
k8s-minor: [25, 26, 27, 28, 29, 30] | |
os: [ubuntu-latest] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install microk8s | |
run: | | |
sudo snap install microk8s --classic --channel=1.${{ matrix.k8s-minor }}/stable | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
- name: go vet | |
run: go vet ./... | |
- name: go test | |
run: go test -v ./... | |
- name: Build kubectl-explore | |
run: | | |
go build | |
chmod +x kubectl-explore | |
sudo install kubectl-explore /usr/local/bin | |
- name: Compare whether the outputs of kubectl-explore and kubectl-explain are the same | |
run: | | |
diff <(sudo microk8s kubectl explore no.*pro | tr -d '[:space:]') <(sudo microk8s kubectl explain node.spec.providerID | tr -d [':space:']) | |
diff <(sudo microk8s kubectl explore node.*pro | tr -d '[:space:]') <(sudo microk8s kubectl explain node.spec.providerID | tr -d [':space:']) | |
diff <(sudo microk8s kubectl explore nodes.*pro | tr -d '[:space:]') <(sudo microk8s kubectl explain node.spec.providerID | tr -d [':space:']) | |
diff <(sudo microk8s kubectl explore provider | tr -d '[:space:]') <(sudo microk8s kubectl explain node.spec.providerID | tr -d [':space:']) | |
- name: Since 1.27+, kubectl-explain has been upgraded to v2 which enables OpenAPI v3 by default | |
run: | | |
diff <(sudo microk8s kubectl explore hpa.*own.*id | tr -d '[:space:]') <(sudo microk8s kubectl explain horizontalpodautoscaler.metadata.ownerReferences.uid | tr -d [':space:']) | |
if: ${{ 26 < matrix.k8s-minor }} |