diff --git a/.github/workflows/jobs.yaml b/.github/workflows/jobs.yaml index a10ce35827..2ac1b79336 100644 --- a/.github/workflows/jobs.yaml +++ b/.github/workflows/jobs.yaml @@ -1536,7 +1536,7 @@ jobs: go tool cover -func=all.out | grep total > tmp2 result=`cat tmp2 | awk 'END {print $3}'` result=${result%\%} - threshold=51.50 + threshold=51.90 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 72f55b197c..509b618b3f 100644 --- a/operator-integration/tenant_test.go +++ b/operator-integration/tenant_test.go @@ -868,3 +868,90 @@ func TestLogout(t *testing.T) { assert.Fail("authentication token not found in cookies response") } } + +func EnableTenantLogging(namespace, tenant string) (*http.Response, error) { + /* + Description: Enable Tenant Logging + HTTP Verb: POST + */ + request, err := http.NewRequest( + "POST", + "http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants/"+tenant+"/enable-logging", + nil, + ) + request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) + request.Header.Add("Content-Type", "application/json") + if err != nil { + log.Println(err) + } + request.Header.Add("Content-Type", "application/json") + client := &http.Client{ + Timeout: 2 * time.Second, + } + response, err := client.Do(request) + return response, err +} + +func DisableTenantLogging(namespace, tenant string) (*http.Response, error) { + /* + Description: Disable Tenant Logging + */ + request, err := http.NewRequest( + "POST", + "http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants/"+tenant+"/disable-logging", + nil, + ) + request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) + request.Header.Add("Content-Type", "application/json") + if err != nil { + log.Println(err) + } + request.Header.Add("Content-Type", "application/json") + client := &http.Client{ + Timeout: 2 * time.Second, + } + response, err := client.Do(request) + return response, err +} + +func TestEnableTenantLogging(t *testing.T) { + // Vars + assert := assert.New(t) + namespace := "tenant-lite" + tenant := "storage-lite" + + // Enable tenant logging + resp, err := EnableTenantLogging(namespace, tenant) + if err != nil { + log.Println(err) + return + } + if resp != nil { + assert.Equal( + 200, + resp.StatusCode, + inspectHTTPResponse(resp), + ) + } +} + +func TestDisableTenantLogging(t *testing.T) { + // Vars + assert := assert.New(t) + namespace := "tenant-lite" + tenant := "storage-lite" + + // Disable tenant logging + resp, err := DisableTenantLogging(namespace, tenant) + if err != nil { + log.Println(err) + return + } + if resp != nil { + assert.Equal( + 200, + resp.StatusCode, + inspectHTTPResponse(resp), + ) + } +}