Skip to content

Commit

Permalink
ci e2e for opct adm parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
mtulio committed Jul 10, 2024
1 parent 72624e5 commit 3f439e7
Showing 1 changed file with 106 additions and 14 deletions.
120 changes: 106 additions & 14 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
name: go-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
# https://github.com/golangci/golangci-lint-action
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: v1.55.2
args: --timeout=10m
Expand All @@ -30,7 +30,7 @@ jobs:
name: "go-staticcheck"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: WillAbides/setup-go-faster@v1.14.0
with:
go-version: '1.22'
Expand All @@ -47,8 +47,8 @@ jobs:
- go-lint
- go-static
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run unit tests
Expand All @@ -61,8 +61,8 @@ jobs:
- go-lint
- go-static
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run go vet
Expand All @@ -76,10 +76,10 @@ jobs:
- go-vet
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.22

Expand All @@ -97,7 +97,7 @@ jobs:
make build-${OS_ARCH}
- name: Save artifacts (OS=linux-amd64)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: opct-linux-amd64
path: |
Expand All @@ -116,14 +116,14 @@ jobs:
name: opct-darwin-arm64
path: |
build/opct-*
cmd-report:
name: "run-report"
e2e-cmd_report:
name: "e2e-cmd_report"
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: opct-linux-amd64
path: /tmp/build/
Expand All @@ -142,3 +142,95 @@ jobs:
echo "> Running OPCT report:"
${CUSTOM_BUILD_PATH} report /tmp/result.tar.gz
e2e-cmd_adm-parse-etcd-logs:
name: "e2e-cmd_adm-parse-etcd-logs"
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: opct-linux-amd64
path: /tmp/build/

- name: Preparing testdata
env:
RESULT_ARTIFACT_URL: "https://openshift-provider-certification.s3.us-west-2.amazonaws.com"
RESULT_ARTIFACT_VERSION: "testdata/must-gather-etcd-logs.tar.gz"
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA: /tmp/must-gather.tar.gz
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
echo "> Downloading sample artifact: ${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
wget -qO ${LOCAL_TEST_DATA} "${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
echo "> Setting run permissions to OPCT:"
chmod u+x ${CUSTOM_BUILD_PATH}
echo "> Extracting testdata:"
mkdir ${LOCAL_TEST_DATA_DIR}
tar xfz ${LOCAL_TEST_DATA} -C ${LOCAL_TEST_DATA_DIR}
- name: "e2e stdin reader: cat <etcd pod logs> | opct adm parse-etcd-logs"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
cat ${LOCAL_TEST_DATA_DIR}/*/*/namespaces/openshift-etcd/pods/*/etcd/etcd/logs/*.log | \
${CUSTOM_BUILD_PATH} adm parse-etcd-logs
- name: "e2e must-gather dir: opct adm parse-etcd-logs <must-gather-dir>"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
${CUSTOM_BUILD_PATH} adm parse-etcd-logs ${LOCAL_TEST_DATA_DIR}
- name: "e2e aggregate by hour: opct adm parse-etcd-logs --aggregator hour <must-gather-dir>"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
${CUSTOM_BUILD_PATH} adm parse-etcd-logs --aggregator hour ${LOCAL_TEST_DATA_DIR}
- name: "e2e ignore error counters: opct adm parse-etcd-logs --skip-error-counter=true <must-gather-dir>"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA_DIR: /tmp/must-gather
run: |
${CUSTOM_BUILD_PATH} adm parse-etcd-logs --skip-error-counter=true ${LOCAL_TEST_DATA_DIR}
e2e-cmd_adm-parse-metrics:
name: "e2e-cmd_adm-parse-metrics"
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: opct-linux-amd64
path: /tmp/build/

- name: Preparing testdata
env:
RESULT_ARTIFACT_URL: "https://openshift-provider-certification.s3.us-west-2.amazonaws.com"
RESULT_ARTIFACT_VERSION: "testdata/ci-external-aws-ccm_1757495441294888960-artifacts_must-gather-metrics.tar.xz"
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA: /tmp/opct-metrics.tar.xz
run: |
echo "> Downloading sample artifact: ${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
wget -qO ${LOCAL_TEST_DATA} "${RESULT_ARTIFACT_URL}/${RESULT_ARTIFACT_VERSION}"
echo "> Setting run permissions to OPCT:"
chmod u+x ${CUSTOM_BUILD_PATH}
- name: "e2e parse metrics: opct adm parse-etcd-logs <must-gather-dir>"
env:
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64
LOCAL_TEST_DATA: /tmp/opct-metrics.tar.xz
run: |
${CUSTOM_BUILD_PATH} adm parse-metrics --input ${LOCAL_TEST_DATA} --output /tmp/metrics
tree /tmp/metrics

0 comments on commit 3f439e7

Please sign in to comment.