api icon indicating copy to clipboard operation
api copied to clipboard

TestRulesAPI failed due to missing the object e2e_rules_api-rules-minio

Open Xxiao-ma opened this issue 3 years ago • 4 comments

The test TestRulesAPI failed while we using CI pipeline to containerize Observatorium-api and break the pipeline, the two sections of logs are related to this, may I ask your support regarding this?

11:01:20 rules-minio: Pull complete
11:01:20 rules-minio: Digest: sha256:a150b34a87e44bb8d9a862c22dd2a737e1918990c6a9f0513f9314c6270921ab
11:01:20 rules-minio: Status: Downloaded newer image for minio/minio:RELEASE.2021-07-27T02-40-15Z
11:01:20 opa: {"current_version":"0.31.0","download_opa":"[https://openpolicyagent.org/downloads/v0.37.1/opa_linux_amd64","latest_version":"0.37.1","level":"info","msg":"OPA](https://openpolicyagent.org/downloads/v0.37.1/opa_linux_amd64%22,%22latest_version%22:%220.37.1%22,%22level%22:%22info%22,%22msg%22:%22OPA) is out of date.","release_notes":"[https://github.com/open-policy-agent/opa/releases/tag/v0.37.1","time":"2022-02-03T11:01:20Z](https://github.com/open-policy-agent/opa/releases/tag/v0.37.1%22,%22time%22:%222022-02-03T11:01:20Z)"}
11:01:20 Ports for container e2e_logs_read_write_tail-opa >> Local ports: map[http:8181] Ports available from host: map[http:49190]
11:01:20 opa: {"client_addr":"172.22.0.1:38834","level":"info","msg":"Received request.","req_id":1,"req_method":"GET","req_path":"/health","time":"2022-02-03T11:01:20Z"}
11:01:20 opa: {"client_addr":"172.22.0.1:38834","level":"info","msg":"Sent response.","req_id":1,"req_method":"GET","req_path":"/health","resp_bytes":2,"resp_duration":3.09471,"resp_status":200,"time":"2022-02-03T11:01:20Z"}
11:01:20 Starting loki
11:01:20 loki: Unable to find image 'grafana/loki:2.3.0' locally
11:01:21 rules-minio: useradd: UID 0 is not unique

Error: No such object: e2e_rules_api-rules-minio

=== CONT  TestRulesAPI
    services.go:57: services.go:57:
        
         unexpected error: failed to get mapping for port as container e2e_rules_api-rules-minio exited: exit status 1: docker container rules-minio failed to start: exit status 1
        
11:01:52 Killing rules-minio
11:01:52 Error response from daemon: Cannot kill container: e2e_rules_api-rules-minio: No such container: e2e_rules_api-rules-minio

11:01:52 Unable to kill service rules-minio : exit status 1
11:01:52 Killing opa
11:01:53 Killing gubernator
11:01:53 Killing dex
--- FAIL: TestRulesAPI (53.75s)
FAIL
FAIL	[github.com/observatorium/api/test/e2e](http://github.com/observatorium/api/test/e2e)	95.152s
FAIL
Makefile:93: recipe for target 'test-e2e' failed
make: *** [test-e2e] Error 1

Xxiao-ma avatar Feb 03 '22 15:02 Xxiao-ma

Hi @Xxiao-ma , thanks for reporting this :) Can you also reproduce this problem locally? (by running make test-e2e) I think this can be related to how the minio server is instantiated - using NewMinio here which leads to here There is an open issue but I'm not sure if its 100% related to that. @matej-g did you happen to encounter the same problem?

jessicalins avatar Feb 03 '22 16:02 jessicalins

Hey @Xxiao-ma @jessicalins, To me this seems to not be directly related to https://github.com/efficientgo/e2e/issues/11, but could have something to do with how the image is being used, where a new user is created as part of the command (see https://github.com/efficientgo/e2e/blob/main/db/db.go#L72).

Do you have any more details @Xxiao-ma, what kind of CI are you running in? Are you perhaps running it as a root user and that could be causing the error you see regarding non-unique UID?

matej-g avatar Feb 03 '22 20:02 matej-g

Hi @jessicalins @matej-g , thanks for replying I'm using the Tekton Pipelines , more details can be found here. I also guess the issue is as @matej-g explained due to the user creation. I'm not sure if I can change the config of how to run the CI Pipeline (as a non root user), since the Tekton we use is SaaS.

Xxiao-ma avatar Feb 04 '22 10:02 Xxiao-ma

Hm, can you perhaps adjust the testing code on your fork, maybe use different approach with Minio, since we currently depend on the workaround I linked before, so I'm not sure if there's an easy way around it.

matej-g avatar Feb 04 '22 16:02 matej-g