netobserv / flowlogs-pipeline

Transform flow logs into metrics
Apache License 2.0
73 stars 23 forks source link

transform_network_test fails #131

Closed KalmanMeth closed 2 years ago

KalmanMeth commented 2 years ago

This test shows up on unrelated PRs.

Run make test

go test -p 1 -race -coverpkg=./... -covermode=atomic -coverprofile=/tmp/coverage.out ./...
ok      github.com/https://github.com/netobserv/[flowlogs-pipeline](https://github.com/netobserv/flowlogs-pipeline)/cmd/apitodoc    0.114s  coverage: 2.5% of statements in ./...
?       github.com/netobserv/flowlogs-pipeline/cmd/confgenerator    [no test files]
ok      github.com/netobserv/flowlogs-pipeline/cmd/flowlogs-pipeline    0.186s  coverage: 0.4% of statements in ./...
?       github.com/netobserv/flowlogs-pipeline/pkg/api  [no test files]
ok      github.com/netobserv/flowlogs-pipeline/pkg/confgen  0.124s  coverage: 6.2% of statements in ./...
?       github.com/netobserv/flowlogs-pipeline/pkg/config   [no test files]
ok      github.com/netobserv/flowlogs-pipeline/pkg/health   2.111s  coverage: 1.5% of statements in ./...
ok      github.com/netobserv/flowlogs-pipeline/pkg/pipeline 4.817s  coverage: 16.9% of statements in ./...
ok      github.com/netobserv/flowlogs-pipeline/pkg/pipeline/decode  0.104s  coverage: 5.1% of statements in ./...
ok      github.com/netobserv/flowlogs-pipeline/pkg/pipeline/encode  2.122s  coverage: 11.8% of statements in ./...
ok      github.com/netobserv/flowlogs-pipeline/pkg/pipeline/extract 0.113s  coverage: 6.9% of statements in ./...
ok      github.com/netobserv/flowlogs-pipeline/pkg/pipeline/extract/aggregate   0.114s  coverage: 6.0% of statements in ./...
ok      github.com/netobserv/flowlogs-pipeline/pkg/pipeline/ingest  3.739s  coverage: 10.2% of statements in ./...
time="2022-03-08T08:54:35Z" level=info msg="Downloading location DB into local file /tmp/location_db.bin "
time="2022-03-08T08:54:35Z" level=info msg="Got reponse 200 OK"
time="2022-03-08T08:54:35Z" level=info msg="Wrote 0 bytes to /tmp/location_db.bin.zip"
time="2022-03-08T08:54:35Z" level=info msg="os.Open err open /tmp/location_db.bin/IP2LOCATION-LITE-DB9.BIN: no such file or directory"
time="2022-03-08T08:54:35Z" level=info msg="ioutil.ReadFile err open /tmp/location_db.bin/IP2LOCATION-LITE-DB9.BIN: no such file or directory"
--- FAIL: Test_Transform (0.09s)
    transform_network_test.go:135: 
            Error Trace:    transform_network_test.go:135
            Error:          Received unexpected error:
                            failed unzip zip: not a valid zip file 
            Test:           Test_Transform
time="2022-03-08T08:54:35Z" level=info msg="Downloading location DB into local file /tmp/location_db.bin "
time="2022-03-08T08:54:35Z" level=info msg="Got reponse 200 OK"
time="2022-03-08T08:54:35Z" level=info msg="Wrote 0 bytes to /tmp/location_db.bin.zip"
time="2022-03-08T08:54:35Z" level=info msg="os.Open err open /tmp/location_db.bin/IP2LOCATION-LITE-DB9.BIN: no such file or directory"
time="2022-03-08T08:54:35Z" level=info msg="ioutil.ReadFile err open /tmp/location_db.bin/IP2LOCATION-LITE-DB9.BIN: no such file or directory"
--- FAIL: Test_TransformAddSubnetParseCIDRFailure (0.02s)
    transform_network_test.go:158: 
            Error Trace:    transform_network_test.go:158
            Error:          Received unexpected error:
                            failed unzip zip: not a valid zip file 
            Test:           Test_TransformAddSubnetParseCIDRFailure
FAIL
coverage: 9.7% of statements in ./...
FAIL    github.com/netobserv/flowlogs-pipeline/pkg/pipeline/transform   0.213s
ok      github.com/netobserv/flowlogs-pipeline/pkg/pipeline/transform/connection_tracking   4.117s  coverage: 3.2% of statements in ./...
ok      github.com/netobserv/flowlogs-pipeline/pkg/pipeline/transform/kubernetes    0.105s  coverage: 1.1% of statements in ./...
time="2022-03-08T08:54:47Z" level=info msg="Downloading location DB into local file /tmp/location_db.bin "
time="2022-03-08T08:54:47Z" level=info msg="Downloading location DB into local file /tmp/location_db.bin "
time="2022-03-08T08:54:47Z" level=info msg="Downloading location DB into local file /tmp/location_db.bin "
time="2022-03-08T08:54:47Z" level=info msg="Got reponse 200 OK"
0s
0s
0s
eranra commented 2 years ago

This was fixed manually ... and happened due to a problem with the new automatic location_db update.

The code was updated here:

https://github.com/netobserv/flowlogs-pipeline/blob/main/.github/workflows/update_location_db.yml

This workflow is running nightly and we need to monitor it... crossing fingers that it will work well tonight :-)

eranra commented 2 years ago

I looked today and it seems like this is resolved. The scheduled task to download the new location DB is running as expected and will update the location DB file just if and when there are changes (it fails when there are no changes, and this is expected) ... so it should be ok now.

Closing the issue :-)