From 2ea56106d4076f2a3b3187ab6abf1a41f3fdcfac Mon Sep 17 00:00:00 2001 From: Liam Beckman Date: Wed, 24 Jul 2024 16:20:33 -0700 Subject: [PATCH] Update unsupported backends response code (400) (#997) * Update unsupported backends response code (400) - Compliance Test: https://github.com/elixir-cloud-aai/openapi-test-runner/blob/dev/tests/create_task_backend_parameters_negative.yml#L32-L35 * Update nextflow.yaml * Update tests.yaml --- .github/workflows/nextflow.yaml | 3 +-- .github/workflows/tests.yaml | 5 +++-- server/server.go | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/nextflow.yaml b/.github/workflows/nextflow.yaml index 57685e72..b137653d 100644 --- a/.github/workflows/nextflow.yaml +++ b/.github/workflows/nextflow.yaml @@ -35,7 +35,6 @@ jobs: path: funnel - name: Start Funnel - working-directory: run: | cd funnel/ chmod +x ./funnel @@ -44,7 +43,7 @@ jobs: - name: Install Nextflow run: | cd .. - git clone https://github.com/nextflow-io/nextflow/ -b tes-update-1.1 + git clone https://github.com/nextflow-io/nextflow cd nextflow make compile diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 9f8654b2..ba170dda 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -16,7 +16,8 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: latest - args: --timeout 3m --verbose -D unused -D errcheck -D staticcheck -D govet -D gosimple -D ineffassign + # TODO: Re-enable all linters + args: --timeout 3m --verbose -D unused -D errcheck -D staticcheck -D govet -D gosimple -D ineffassign -D typecheck build: runs-on: ubuntu-latest @@ -138,4 +139,4 @@ jobs: make start-generic-s3 sleep 10 make test-generic-s3 - \ No newline at end of file + diff --git a/server/server.go b/server/server.go index 871b382e..15f7f677 100644 --- a/server/server.go +++ b/server/server.go @@ -78,13 +78,17 @@ func customErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler ru w.WriteHeader(http.StatusForbidden) // 403 case codes.NotFound: // Special case for missing tasks (TES Compliance Suite) - if (strings.Contains(st.Message(), "task not found")) { + if strings.Contains(st.Message(), "task not found") { w.WriteHeader(http.StatusInternalServerError) // 500 } else { w.WriteHeader(http.StatusNotFound) // 404 } default: - w.WriteHeader(http.StatusInternalServerError) // 500 + if strings.Contains(st.Message(), "backend parameters not supported") { + w.WriteHeader(http.StatusBadRequest) // 400 + } else { + w.WriteHeader(http.StatusInternalServerError) // 500 + } } // Write the error message