From ae21a4d029ed3960038019ce28ba19bbcc931e1b Mon Sep 17 00:00:00 2001 From: KH <> Date: Thu, 12 Dec 2024 18:25:38 -0800 Subject: [PATCH] Updated coverage; separate svg err msg in UI --- .github/workflows/go.yml | 13 +++++++++++++ ui/src/routes/KsMatrix.svelte | 4 +++- ui/src/routes/KsRunNodeHistory.svelte | 5 ++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 03e3b19..cdaf8f1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,6 +40,19 @@ jobs: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: goveralls -coverprofile=/var/tmp/capillaries.p -service=github + - name: pkg/capigraph test coverage threshold check + env: + TESTCOVERAGE_THRESHOLD: 93.9 + run: | + go test -v ./pkg/capigraph/... -coverprofile coverage.out -covermode count + totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` + if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then + echo -e "\033[32mOK: $totalCoverage >= $TESTCOVERAGE_THRESHOLD\033[0m" + else + echo -e "\033[31mFAILED: $totalCoverage < $TESTCOVERAGE_THRESHOLD. Cover more with unit tests or adjust threshold to a lower value.\033[0m" + exit 1 + fi + - name: pkg/cql test coverage threshold check env: TESTCOVERAGE_THRESHOLD: 87.6 diff --git a/ui/src/routes/KsMatrix.svelte b/ui/src/routes/KsMatrix.svelte index 5469650..70b08e2 100755 --- a/ui/src/routes/KsMatrix.svelte +++ b/ui/src/routes/KsMatrix.svelte @@ -24,6 +24,7 @@ let breadcrumbsPathElements = $state([]); let svgScriptViz = $state(''); + let svgError = $state(''); let webapiData = $state({ run_lifespans: [], nodes: [] }); let responseError = $state(''); var timer; @@ -86,7 +87,7 @@ svgScriptViz = responseText; }) .catch((error) => { - responseError = + svgError = 'cannot fetch SVG viz from Capillaries webapi at ' + method + ' ' + @@ -209,6 +210,7 @@ {/snippet} {#snippet tabViz()} +
{svgError}
{#if webapiData.run_lifespans.length > 0}This diagram is static. To see it in a separate window, click { - responseError = + svgError = 'cannot fetch SVG status viz from Capillaries webapi at ' + method + ' ' + @@ -230,6 +231,8 @@ or here for colored by root node.
+{svgError}
+