Skip to content

Commit

Permalink
add qase report
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco <francisco.moral@suse.com>
  • Loading branch information
fmoral2 committed Jun 5, 2024
1 parent b73f2f8 commit e69e88f
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 39 deletions.
Binary file added .DS_Store
Binary file not shown.
153 changes: 117 additions & 36 deletions .github/workflows/nightly-install.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Nightly Install
on:
schedule:
- cron: "0 0 * * 1-5"
workflow_dispatch: {}
push: {}
# schedule:
# - cron: "0 0 * * 1-5"
# workflow_dispatch: {}

permissions:
contents: read
Expand All @@ -18,42 +19,122 @@ jobs:
channel: [stable, latest]
vm: [rocky-8, fedora, opensuse-leap, ubuntu-2204]
max-parallel: 4
defaults:
run:
working-directory: tests/install/${{ matrix.vm }}
# defaults:
# run:
# working-directory: tests/install/${{ matrix.vm }}
env:
INSTALL_K3S_CHANNEL: ${{ matrix.channel }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
with: {fetch-depth: 1}
- name: Set up vagrant and libvirt
uses: ./.github/actions/vagrant-setup
- name: "Vagrant Cache"
uses: actions/cache@v4
with:
path: |
~/.vagrant.d/boxes
key: vagrant-box-${{ matrix.vm }}
id: vagrant-cache
- name: "Vagrant Plugin(s)"
run: vagrant plugin install vagrant-k3s vagrant-reload
- name: "Vagrant Up ⏩ Install K3s"
run: vagrant up
- name: "⏳ Node"
run: vagrant provision --provision-with=k3s-wait-for-node
- name: "⏳ CoreDNS"
run: vagrant provision --provision-with=k3s-wait-for-coredns
- name: "⏳ Local Storage"
run: vagrant provision --provision-with=k3s-wait-for-local-storage
continue-on-error: true
- name: "⏳ Metrics Server"
run: vagrant provision --provision-with=k3s-wait-for-metrics-server
continue-on-error: true
- name: "⏳ Traefik"
run: vagrant provision --provision-with=k3s-wait-for-traefik
continue-on-error: true
- name: "k3s-status"
run: vagrant provision --provision-with=k3s-status
- name: "k3s-procps"
run: vagrant provision --provision-with=k3s-procps
# - name: Set up vagrant and libvirt
# uses: ./.github/actions/vagrant-setup
# - name: "Vagrant Cache"
# uses: actions/cache@v4
# with:
# path: |
# ~/.vagrant.d/boxes
# key: vagrant-box-${{ matrix.vm }}
# id: vagrant-cache
# - name: "Vagrant Plugin(s)"
# run: vagrant plugin install vagrant-k3s vagrant-reload
# - name: "Vagrant Up ⏩ Install K3s"
# run: vagrant up
# - name: "⏳ Node"
# run: vagrant provision --provision-with=k3s-wait-for-node
# - name: "⏳ CoreDNS"
# run: vagrant provision --provision-with=k3s-wait-for-coredns
# - name: "⏳ Local Storage"
# run: vagrant provision --provision-with=k3s-wait-for-local-storage
# continue-on-error: true
# - name: "⏳ Metrics Server"
# run: vagrant provision --provision-with=k3s-wait-for-metrics-server
# continue-on-error: true
# - name: "⏳ Traefik"
# run: vagrant provision --provision-with=k3s-wait-for-traefik
# continue-on-error: true
# - name: "k3s-status"
# run: vagrant provision --provision-with=k3s-status
# - name: "k3s-procps"
# run: vagrant provision --provision-with=k3s-procps

- name: Create Qase Run
id: qase
env:
QASE_API_TOKEN: ${{ secrets.QASE_API_TOKEN }}
run: |
sudo apt-get install jq
# create a QASE_RUN_NAME DINAMICALLY
QASE_RUN_NAME="Install K3s on ${{ matrix.vm }}"
# create a run ID
RESPONSE=$(curl --request POST \
--url https://api.qase.io/v1/run/DEMO \
--header 'Token: $QASE_API_TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"cases": [
0,
1
],
"is_autotest": true,
"title": "'"$QASE_RUN_NAME"'",
}'
)
# set the run ID as an output variable
RUN_ID=$(echo $RESPONSE | jq -r '.result.id')
# Print the RUN_ID to verify
echo "The RUN_ID is: $RUN_ID"
# Set the run ID as an output variable using the environment file
echo "QASE_RUN_ID=$RUN_ID" >> $GITHUB_ENV
## step
# complete the run
COMPLETE_RUN=$(curl --request POST \
--url https://api.qase.io/v1/run/K3SRKE2/$RUN_ID/complete \
--header 'Token: $QASE_API_TOKEN' \
--header 'accept: application/json'
)
RUN_STATUS=$(echo $COMPLETE_RUN | jq -r '.status')
if [[ $RUN_STATUS != true ]]; then
echo "Failed to complete the run"
fi
# # make run public
# PUBLISH_RUN=$(curl --request PATCH \
# --url https://api.qase.io/v1/run/K3SRKE2/$RUN_ID/public \
# --header 'Token: $QASE_API_TOKEN' \
# --header 'accept: application/json' \
# --header 'content-type: application/json' \
# --data '{"status":true}'
# )
#
# REPORT_URL=$(echo $PUBLISH_RUN | jq -r '.result.url')
# if [[ -n "${REPORT_URL}" ]]; then
# echo report url: ${REPORT_URL}
# echo "## QASE Reporting" >> ${GITHUB_STEP_SUMMARY}
# echo "Public Qase report: ${REPORT_URL}" >> ${GITHUB_STEP_SUMMARY}
# fi

- name: Run Tests and Upload Results to Qase
env:
QASE_API_TOKEN: ${{ secrets.QASE_API_TOKEN }}
QASE_RUN_ID: ${{ env.QASE_RUN_ID }}
run: |
echo "Run K3s Smoke Test"
#Example: ./run-tests.sh and capture results in a file, e.g., test-results.json
./run-tests.sh > test-results.json



3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/common v0.49.0
github.com/rancher-sandbox/qase-ginkgo v1.0.1
github.com/rancher/dynamiclistener v0.6.0-rc1
github.com/rancher/lasso v0.0.0-20240430201833-6f3def65ffc5
github.com/rancher/remotedialer v0.3.0
Expand Down Expand Up @@ -179,6 +180,7 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/Rican7/retry v0.1.0 // indirect
github.com/antihax/optional v1.0.0 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
Expand Down Expand Up @@ -430,6 +432,7 @@ require (
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.qase.io/client v0.0.0-20231114201952-65195ec001fa // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/dig v1.17.1 // indirect
go.uber.org/fx v1.20.1 // indirect
Expand Down
7 changes: 5 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2B
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Microsoft/hcsshim v0.11.0 h1:7EFNIY4igHEXUdj1zXgAyU3fLc7QfOKHbkldRVTBdiM=
github.com/Microsoft/hcsshim v0.11.0/go.mod h1:OEthFdQv/AD2RAdzR6Mm1N1KPCztGKDurW1Z8b8VGMM=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
Expand All @@ -276,6 +274,7 @@ github.com/alexflint/go-filemutex v1.2.0/go.mod h1:mYyQSWvw9Tx2/H2n9qXPb52tTYfE0
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM=
Expand Down Expand Up @@ -1401,10 +1400,14 @@ github.com/quic-go/quic-go v0.42.0 h1:uSfdap0eveIl8KXnipv9K7nlwZ5IqLlYOpJ58u5utp
github.com/quic-go/quic-go v0.42.0/go.mod h1:132kz4kL3F9vxhW3CtQJLDVwcFe5wdWeJXXijhsO57M=
github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY=
github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc=
github.com/rancher-sandbox/qase-ginkgo v1.0.1 h1:LB9ITLavX3PmcOe0hp0Y7rwQCjJ3WpL8kG8v1MxPadE=
github.com/rancher-sandbox/qase-ginkgo v1.0.1/go.mod h1:sIF43xaLHtEzmPqADKlZZV6oatc66GHz1N6gpBNn6QY=
github.com/rancher/dynamiclistener v0.6.0-rc1 h1:Emwf9o7PMLdQNv4lvFx7xJKxDuDa4Y69GvVEGU9U9Js=
github.com/rancher/dynamiclistener v0.6.0-rc1/go.mod h1:BIPgJ8xFSUyuTyGvRMVt++S1qjD3+7Ptvq1TXl6hcTM=
github.com/rancher/lasso v0.0.0-20240430201833-6f3def65ffc5 h1:6K4RhfmCy7uxaw9OzCljNLfFcgD/q7SeF+/2gCQ3Tvw=
github.com/rancher/lasso v0.0.0-20240430201833-6f3def65ffc5/go.mod h1:7WkdfPEvWAdnHVioMUkhpZkshJzjDY62ocHVhcbw89M=
github.com/rancher/qase-go/client v0.0.0-20231114201952-65195ec001fa h1:/qeYlQVfyvsO5yY0dZmm7mRTAsDm54jACiRDx3LAwsA=
github.com/rancher/qase-go/client v0.0.0-20231114201952-65195ec001fa/go.mod h1:NP3xboG+t2p+XMnrcrJ/L384Ki0Cp3Pww/X+vm5Jcy0=
github.com/rancher/remotedialer v0.3.0 h1:y1EO8JCsgZo0RcqTUp6U8FXcBAv27R+TLnWRcpvX1sM=
github.com/rancher/remotedialer v0.3.0/go.mod h1:BwwztuvViX2JrLLUwDlsYt5DiyUwHLlzynRwkZLAY0Q=
github.com/rancher/wharfie v0.6.4 h1:JwYB+q661n8ut/ysgsjKe0P0z6bHCCFoC+29995ME90=
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/startup/startup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"strings"
"testing"

"github.com/k3s-io/k3s/tests/e2e"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/k3s-io/k3s/tests/e2e"
)

// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64
Expand Down
10 changes: 10 additions & 0 deletions tests/install/rocky-8/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ Vagrant.configure("2") do |config|
YAML
k3s.config_mode = '0644' # side-step https://github.com/k3s-io/k3s/issues/4321
end


def log_result(test_case, status)
File.open("/install/test-results.json", "a") do |f|
f.puts({case_id: test_case, status: status}.to_json)
end
end



waitForNodeReady(test.vm)

waitForCoreDns(test.vm)
Expand Down
3 changes: 3 additions & 0 deletions tests/install/test_results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}

0 comments on commit e69e88f

Please sign in to comment.