Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functon controller git unit tests sometimes fails #12953

Closed
dbadura opened this issue Dec 30, 2021 · 3 comments
Closed

Functon controller git unit tests sometimes fails #12953

dbadura opened this issue Dec 30, 2021 · 3 comments
Assignees
Labels
area/serverless Issues or PRs related to serverless kind/bug Categorizes issue or PR as related to a bug.

Comments

@dbadura
Copy link
Contributor

dbadura commented Dec 30, 2021

Description
I noticed that function controller git unit test sometimes fails.

Expected result

Unit test shouldn't fail.

Actual result
Log:

2021/12/30 09:42:53 UTC [INFO] Authenticating to gcloud
Activated service account credentials for: [[email protected]]
2021/12/30 09:42:54 UTC [INFO] *************************************************************************************
2021/12/30 09:42:54 UTC [INFO] * Starting Docker...
2021/12/30 09:42:54 UTC [INFO] *************************************************************************************
================================================================================
Starting Docker: docker.
2021/12/30 09:42:54 UTC [INFO] Waiting for docker to be ready, sleeping for 1 seconds.
================================================================================
Authenticating in registry eu.gcr.io as [email protected]
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
Done starting up docker.
Building from PR
DOCKER_TAG PR-12937
[0002] | make: Entering directory '/home/prow/go/src/github.com/kyma-project/kyma/components/function-controller'
[0002] | Makefile:25: warning: overriding recipe for target 'pull-licenses-local'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:216: warning: ignoring old recipe for target 'pull-licenses-local'
[0002] | Makefile:28: warning: overriding recipe for target 'release'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:93: warning: ignoring old recipe for target 'release'
[0002] | Makefile:34: warning: overriding recipe for target 'test-local'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:226: warning: ignoring old recipe for target 'test-local'
[0002] | Makefile:51: warning: overriding recipe for target 'generate-local'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:199: warning: ignoring old recipe for target 'generate-local'
[0002] | Makefile:75: warning: overriding recipe for target 'build-image'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:107: warning: ignoring old recipe for target 'build-image'
[0002] | Makefile:81: warning: overriding recipe for target 'push-image'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:109: warning: ignoring old recipe for target 'push-image'
[0002] | Makefile:87: warning: overriding recipe for target 'build-image'
[0002] | Makefile:75: warning: ignoring old recipe for target 'build-image'
[0002] | Makefile:93: warning: overriding recipe for target 'push-image'
[0002] | Makefile:81: warning: ignoring old recipe for target 'push-image'
[0002] | make gomod-release-local
[0002] | make[1]: Entering directory '/home/prow/go/src/github.com/kyma-project/kyma/components/function-controller'
[0002] | Makefile:25: warning: overriding recipe for target 'pull-licenses-local'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:216: warning: ignoring old recipe for target 'pull-licenses-local'
[0002] | Makefile:28: warning: overriding recipe for target 'release'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:93: warning: ignoring old recipe for target 'release'
[0002] | Makefile:34: warning: overriding recipe for target 'test-local'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:226: warning: ignoring old recipe for target 'test-local'
[0002] | Makefile:51: warning: overriding recipe for target 'generate-local'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:199: warning: ignoring old recipe for target 'generate-local'
[0002] | Makefile:75: warning: overriding recipe for target 'build-image'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:107: warning: ignoring old recipe for target 'build-image'
[0002] | Makefile:81: warning: overriding recipe for target 'push-image'
[0002] | /home/prow/go/src/github.com/kyma-project/kyma/common/makefiles/generic-make-go.mk:109: warning: ignoring old recipe for target 'push-image'
[0002] | Makefile:87: warning: overriding recipe for target 'build-image'
[0002] | Makefile:75: warning: ignoring old recipe for target 'build-image'
[0002] | Makefile:93: warning: overriding recipe for target 'push-image'
[0002] | Makefile:81: warning: ignoring old recipe for target 'push-image'
[0002] | GO111MODULE=on go mod vendor
[0004] | go: downloading go.uber.org/zap v1.16.0
[0004] | go: downloading k8s.io/apimachinery v0.18.18
[0004] | go: downloading k8s.io/client-go v0.18.18
[0004] | go: downloading github.com/go-logr/zapr v0.1.0
[0004] | go: downloading github.com/vrischmann/envconfig v1.3.0
[0004] | go: downloading sigs.k8s.io/controller-runtime v0.6.5
[0004] | go: downloading github.com/pkg/errors v0.9.1
[0004] | go: downloading knative.dev/pkg v0.0.0-20210217160502-b7d7ff183788
[0004] | go: downloading github.com/onsi/gomega v1.10.1
[0004] | go: downloading github.com/stretchr/testify v1.7.0
[0004] | go: downloading k8s.io/api v0.18.18
[0004] | go: downloading github.com/libgit2/git2go/v31 v31.4.14
[0004] | go: downloading golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
[0004] | go: downloading github.com/go-logr/logr v0.1.0
[0004] | go: downloading golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
[0004] | go: downloading gopkg.in/yaml.v2 v2.3.0
[0004] | go: downloading go.uber.org/atomic v1.7.0
[0004] | go: downloading go.uber.org/multierr v1.5.0
[0004] | go: downloading github.com/spf13/pflag v1.0.5
[0004] | go: downloading github.com/prometheus/client_golang v1.8.0
[0004] | go: downloading gomodules.xyz/jsonpatch/v2 v2.1.0
[0004] | go: downloading github.com/gogo/protobuf v1.3.2
[0004] | go: downloading k8s.io/klog v1.0.0
[0004] | go: downloading sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba
[0004] | go: downloading github.com/evanphx/json-patch v4.9.0+incompatible
[0004] | go: downloading github.com/google/gofuzz v1.1.0
[0004] | go: downloading github.com/davecgh/go-spew v1.1.1
[0004] | go: downloading github.com/pmezard/go-difflib v1.0.0
[0004] | go: downloading github.com/stretchr/objx v0.2.0
[0004] | go: downloading k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19
[0004] | go: downloading gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
[0004] | go: downloading gopkg.in/inf.v0 v0.9.1
[0004] | go: downloading go.uber.org/automaxprocs v1.3.0
[0004] | go: downloading golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
[0004] | go: downloading github.com/google/uuid v1.1.2
[0004] | go: downloading go.opencensus.io v0.22.5
[0004] | go: downloading github.com/markbates/inflect v1.0.4
[0004] | go: downloading k8s.io/apiextensions-apiserver v0.18.12
[0004] | go: downloading sigs.k8s.io/yaml v1.2.0
[0005] | go: downloading golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5
[0005] | go: downloading github.com/fsnotify/fsnotify v1.4.9
[0005] | go: downloading github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
[0005] | go: downloading golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2
[0005] | go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
[0005] | go: downloading github.com/prometheus/client_model v0.2.0
[0005] | go: downloading github.com/prometheus/common v0.15.0
[0005] | go: downloading github.com/beorn7/perks v1.0.1
[0005] | go: downloading github.com/cespare/xxhash/v2 v2.1.1
[0005] | go: downloading github.com/golang/protobuf v1.4.3
[0005] | go: downloading github.com/prometheus/procfs v0.2.0
[0005] | go: downloading golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
[0005] | go: downloading github.com/kelseyhightower/envconfig v1.4.0
[0005] | go: downloading github.com/blendle/zapdriver v1.3.1
[0005] | go: downloading cloud.google.com/go v0.72.0
[0005] | go: downloading contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d
[0005] | go: downloading contrib.go.opencensus.io/exporter/prometheus v0.2.1-0.20200609204449-6bcf6f8577f0
[0005] | go: downloading contrib.go.opencensus.io/exporter/stackdriver v0.13.4
[0005] | go: downloading google.golang.org/api v0.36.0
[0005] | go: downloading google.golang.org/grpc v1.34.0
[0005] | go: downloading github.com/blang/semver/v4 v4.0.0
[0005] | go: downloading github.com/imdario/mergo v0.3.12
[0005] | go: downloading github.com/gobuffalo/envy v1.7.1
[0005] | go: downloading gopkg.in/evanphx/json-patch.v4 v4.9.0
[0005] | go: downloading github.com/google/go-cmp v0.5.4
[0005] | go: downloading github.com/json-iterator/go v1.1.10
[0005] | go: downloading github.com/blang/semver v3.5.0+incompatible
[0005] | go: downloading k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
[0005] | go: downloading github.com/googleapis/gnostic v0.4.0
[0005] | go: downloading github.com/modern-go/reflect2 v1.0.1
[0005] | go: downloading github.com/hashicorp/golang-lru v0.5.4
[0005] | go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
[0005] | go: downloading k8s.io/klog/v2 v2.0.0
[0005] | go: downloading google.golang.org/protobuf v1.25.0
[0005] | go: downloading golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
[0005] | go: downloading google.golang.org/appengine v1.6.7
[0005] | go: downloading github.com/prometheus/statsd_exporter v0.15.0
[0005] | go: downloading github.com/census-instrumentation/opencensus-proto v0.3.0
[0005] | go: downloading github.com/joho/godotenv v1.3.0
[0005] | go: downloading github.com/rogpeppe/go-internal v1.5.2
[0005] | go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
[0005] | go: downloading google.golang.org/genproto v0.0.0-20201211151036-40ec1c210f7a
[0005] | go: downloading golang.org/x/text v0.3.5
[0005] | go: downloading github.com/grpc-ecosystem/grpc-gateway v1.14.8
[0005] | go: downloading github.com/googleapis/gax-go/v2 v2.0.5
[0006] | go: downloading github.com/sirupsen/logrus v1.6.0
[0006] | go: downloading gopkg.in/alecthomas/kingpin.v2 v2.2.6
[0006] | go: downloading github.com/aws/aws-sdk-go v1.31.12
[0006] | go: downloading github.com/konsorten/go-windows-terminal-sequences v1.0.3
[0006] | go: downloading github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
[0006] | go: downloading github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
[0007] | go: downloading github.com/jmespath/go-jmespath v0.3.0
[0008] | GO111MODULE=on go mod verify
[0010] | all modules verified
[0010] | mkdir -p /tmp/artifacts
[0010] | go test -race -coverprofile=/tmp/artifacts/cover.out ./...
[0039] | ?   	github.com/kyma-project/kyma/components/function-controller/cmd/jobinit	[no test files]
[0039] | ?   	github.com/kyma-project/kyma/components/function-controller/cmd/manager	[no test files]
[0039] | ?   	github.com/kyma-project/kyma/components/function-controller/cmd/webhook	[no test files]
[0076] | ok  	github.com/kyma-project/kyma/components/function-controller/internal/controllers/kubernetes	41.517s	coverage: 82.4% of statements
[0076] | --- FAIL: TestGitOps_GitErrorHandling (5.41s)
[0076] | --- FAIL: TestGitOps_GitErrorHandling/Check_if_Requeue_is_set_to_true_in_case_of_recoverable_error (0.07s)
[0076] | function_reconcile_gitops_test.go:449:
[0076] | Expected
[0076] | <string>: Stop reconciliation, reason: libgit2 was not built with OpenSSL support
[0076] | to equal
[0076] | <string>: Stop reconciliation, reason: NotFound
[0076] | panic.go:661: PASS:	LastCommit(git.Options)
[0076] | FAIL
[0076] | coverage: 85.5% of statements
[0076] | FAIL	github.com/kyma-project/kyma/components/function-controller/internal/controllers/serverless	26.333s
[0076] | ?   	github.com/kyma-project/kyma/components/function-controller/internal/controllers/serverless/automock	[no test files]
[0076] | ok  	github.com/kyma-project/kyma/components/function-controller/internal/controllers/serverless/runtime	0.054s	coverage: 73.3% of statements
[0076] | ok  	github.com/kyma-project/kyma/components/function-controller/internal/docker	0.030s	coverage: 100.0% of statements
[0076] | ok  	github.com/kyma-project/kyma/components/function-controller/internal/git	2.019s	coverage: 79.5% of statements
[0076] | ok  	github.com/kyma-project/kyma/components/function-controller/internal/resource	0.123s	coverage: 57.1% of statements
[0076] | ?   	github.com/kyma-project/kyma/components/function-controller/internal/resource/automock	[no test files]
[0076] | ok  	github.com/kyma-project/kyma/components/function-controller/pkg/apis/serverless/v1alpha1	0.063s	coverage: 43.2% of statements
[0076] | FAIL
[0076] | make[1]: *** [Makefile:35: test-local] Error 1
[0076] | make[1]: Leaving directory '/home/prow/go/src/github.com/kyma-project/kyma/components/function-controller'
[0076] | make: *** [Makefile:28: release] Error 2
[0076] | make: Leaving directory '/home/prow/go/src/github.com/kyma-project/kyma/components/function-controller'

Steps to reproduce

Troubleshooting

@dbadura dbadura added kind/bug Categorizes issue or PR as related to a bug. area/serverless Issues or PRs related to serverless labels Dec 30, 2021
@Cortey Cortey self-assigned this Jan 3, 2022
@dbadura
Copy link
Contributor Author

dbadura commented Jan 12, 2022

I was able to generate the openssl error runing such single test:

func TestLibGit2InitError(t *testing.T) {
	gitErr := git2go.MakeGitError2(int(git2go.ErrorCodeNotFound))
	fmt.Println(gitErr)
}

It looks like there is a problem in initialization of libgit2:
https://github.com/libgit2/git2go/blob/main/git.go#L135
calls:
https://github.com/libgit2/libgit2/blob/main/src/streams/openssl.c#L741

@dbadura
Copy link
Contributor Author

dbadura commented Jan 12, 2022

I noticed that the openssl init error is time dependend:

func TestLibGit2InitError(t *testing.T) {
	// the more time pass, the possibility of openssl init error occurrence is smaller, because something wipes it
	time.Sleep(3*time.Microsecond)
	//if sleep is set to less than 3 um, then we have a high possibility of noticing git openssl init error.
	//the sleep time border value depends on computer
	gitErr := git2go.MakeGitError2(int(git2go.ErrorCodeNotFound))
	fmt.Println(gitErr)
}

@dbadura
Copy link
Contributor Author

dbadura commented Jan 12, 2022

I created issue in git2go: libgit2/git2go#873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/serverless Issues or PRs related to serverless kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants