From 617d41584ea9f7c3fd72291253d99a7a53376210 Mon Sep 17 00:00:00 2001 From: Cesar Celis Hernandez Date: Wed, 8 Jun 2022 12:05:42 -0400 Subject: [PATCH] Get Tenant Details (#2097) --- .github/workflows/jobs.yaml | 2 +- operator-integration/tenant_test.go | 43 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jobs.yaml b/.github/workflows/jobs.yaml index f98cb513a..ca537b80e 100644 --- a/.github/workflows/jobs.yaml +++ b/.github/workflows/jobs.yaml @@ -1605,7 +1605,7 @@ jobs: go tool cover -func=all.out | grep total > tmp2 result=`cat tmp2 | awk 'END {print $3}'` result=${result%\%} - threshold=52.60 + threshold=53.40 echo "Result:" echo "$result%" if (( $(echo "$result >= $threshold" |bc -l) )); then diff --git a/operator-integration/tenant_test.go b/operator-integration/tenant_test.go index 4ae7af01b..49c421377 100644 --- a/operator-integration/tenant_test.go +++ b/operator-integration/tenant_test.go @@ -1083,3 +1083,46 @@ func TestSetTenantLogs(t *testing.T) { ) } } + +func TenantDetails(nameSpace, tenant string) (*http.Response, error) { + /* + url: /namespaces/{namespace}/tenants/{tenant} + summary: Tenant Details + operationId: TenantDetails + HTTP Verb: GET + */ + request, err := http.NewRequest( + "GET", + "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant, + nil, + ) + if err != nil { + log.Println(err) + } + request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) + request.Header.Add("Content-Type", "application/json") + client := &http.Client{ + Timeout: 2 * time.Second, + } + response, err := client.Do(request) + return response, err +} + +func TestTenantDetails(t *testing.T) { + // Vars + assert := assert.New(t) + nameSpace := "tenant-lite" + tenant := "storage-lite" + resp, err := TenantDetails(nameSpace, tenant) + if err != nil { + log.Println(err) + return + } + if resp != nil { + assert.Equal( + 200, + resp.StatusCode, + inspectHTTPResponse(resp), + ) + } +}