Skip to content

Commit

Permalink
test: Refactor tests
Browse files Browse the repository at this point in the history
- Move all packages to internal folder except apis and client
- Refactor controller and webhook tests
  • Loading branch information
tommy351 committed May 12, 2019
1 parent dbcc3c4 commit e30df5d
Show file tree
Hide file tree
Showing 121 changed files with 1,820 additions and 1,437 deletions.
16 changes: 1 addition & 15 deletions .circleci/config.yml
Expand Up @@ -28,20 +28,11 @@ jobs:
steps:
- checkout
- go_get
- run: hack/download-test-assets.sh
- run: hack/run-test.sh
- store_test_results:
path: reports/junit
- run: bash <(curl -s https://codecov.io/bash)
test_integration:
docker:
- image: circleci/golang:1.12
steps:
- checkout
- go_get
- run: hack/download-test-assets.sh
- run: hack/run-test.sh -tags integration
- store_test_results:
path: reports/junit
release:
docker:
- image: circleci/golang:1.12
Expand All @@ -66,15 +57,10 @@ workflows:
filters:
tags:
only: /.*/
- test_integration:
filters:
tags:
only: /.*/
- release:
requires:
- lint
- test_go
- test_integration
filters:
branches:
ignore: /.*/
Expand Down
4 changes: 2 additions & 2 deletions cmd/config.go
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/google/wire"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tommy351/pullup/pkg/k8s"
"github.com/tommy351/pullup/pkg/log"
"github.com/tommy351/pullup/internal/k8s"
"github.com/tommy351/pullup/internal/log"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/controller/manager.go
@@ -1,11 +1,11 @@
package main

import (
"github.com/tommy351/pullup/internal/controller/resourceset"
"github.com/tommy351/pullup/internal/controller/webhook"
"github.com/tommy351/pullup/internal/k8s"
"github.com/tommy351/pullup/internal/metrics"
"github.com/tommy351/pullup/pkg/apis/pullup/v1alpha1"
"github.com/tommy351/pullup/pkg/controller/resourceset"
"github.com/tommy351/pullup/pkg/controller/webhook"
"github.com/tommy351/pullup/pkg/k8s"
"github.com/tommy351/pullup/pkg/metrics"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/builder"
Expand Down
10 changes: 5 additions & 5 deletions cmd/controller/wire.go
Expand Up @@ -5,11 +5,11 @@ package main
import (
"github.com/google/wire"
"github.com/tommy351/pullup/cmd"
"github.com/tommy351/pullup/pkg/controller/resourceset"
"github.com/tommy351/pullup/pkg/controller/webhook"
"github.com/tommy351/pullup/pkg/k8s"
"github.com/tommy351/pullup/pkg/log"
"github.com/tommy351/pullup/pkg/metrics"
"github.com/tommy351/pullup/internal/controller/resourceset"
"github.com/tommy351/pullup/internal/controller/webhook"
"github.com/tommy351/pullup/internal/k8s"
"github.com/tommy351/pullup/internal/log"
"github.com/tommy351/pullup/internal/metrics"
)

func InitializeManager(conf cmd.Config) (*Manager, func(), error) {
Expand Down
10 changes: 5 additions & 5 deletions cmd/controller/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/webhook/main.go
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tommy351/pullup/cmd"
"github.com/tommy351/pullup/pkg/webhook"
"github.com/tommy351/pullup/pkg/webhook/github"
"github.com/tommy351/pullup/internal/webhook"
"github.com/tommy351/pullup/internal/webhook/github"
)

type Config struct {
Expand Down
6 changes: 3 additions & 3 deletions cmd/webhook/manager.go
@@ -1,9 +1,9 @@
package main

import (
"github.com/tommy351/pullup/pkg/metrics"
"github.com/tommy351/pullup/pkg/webhook"
"github.com/tommy351/pullup/pkg/webhook/github"
"github.com/tommy351/pullup/internal/metrics"
"github.com/tommy351/pullup/internal/webhook"
"github.com/tommy351/pullup/internal/webhook/github"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/manager"
Expand Down
8 changes: 4 additions & 4 deletions cmd/webhook/wire.go
Expand Up @@ -5,10 +5,10 @@ package main
import (
"github.com/google/wire"
"github.com/tommy351/pullup/cmd"
"github.com/tommy351/pullup/pkg/k8s"
"github.com/tommy351/pullup/pkg/log"
"github.com/tommy351/pullup/pkg/metrics"
"github.com/tommy351/pullup/pkg/webhook"
"github.com/tommy351/pullup/internal/k8s"
"github.com/tommy351/pullup/internal/log"
"github.com/tommy351/pullup/internal/metrics"
"github.com/tommy351/pullup/internal/webhook"
)

func InitializeManager(conf Config) (*Manager, func(), error) {
Expand Down
10 changes: 5 additions & 5 deletions cmd/webhook/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 26 additions & 19 deletions go.mod
Expand Up @@ -19,19 +19,21 @@ require (
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.3.0
github.com/google/go-github/v24 v24.0.2-0.20190405195805-c22c8e3046a5
github.com/google/go-github/v25 v25.0.2
github.com/google/gofuzz v1.0.0 // indirect
github.com/google/uuid v1.1.1
github.com/google/wire v0.2.1
github.com/google/wire v0.2.2
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/gophercloud/gophercloud v0.0.0-20190504011306-6f9faf57fddc // indirect
github.com/gophercloud/gophercloud v0.0.0-20190509032623-7892efa714f1 // indirect
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
github.com/grpc-ecosystem/grpc-gateway v1.8.6 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/huandu/xstrings v1.2.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/justinas/alice v0.0.0-20171023064455-03f45bd4b7da
github.com/magiconair/properties v1.8.1 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/onsi/ginkgo v1.8.0
github.com/onsi/gomega v1.5.0
Expand All @@ -41,37 +43,42 @@ require (
github.com/pkg/errors v0.8.1 // indirect
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
github.com/prometheus/common v0.3.0 // indirect
github.com/prometheus/procfs v0.0.0-20190503130316-740c07785007 // indirect
github.com/prometheus/common v0.4.0 // indirect
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 // indirect
github.com/sergi/go-diff v1.0.0
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.3.2
github.com/stretchr/testify v1.3.0 // indirect
github.com/zenazn/goji v0.9.0
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.10.0
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 // indirect
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c // indirect
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 // indirect
golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5 // indirect
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a // indirect
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 // indirect
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373
golang.org/x/xerrors v0.0.0-20190510150013-5403a72a6aaf
google.golang.org/api v0.5.0 // indirect
google.golang.org/appengine v1.5.0 // indirect
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 // indirect
google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20190222213804-5cb15d344471
k8s.io/apiextensions-apiserver v0.0.0-20190228180357-d002e88f6236 // indirect
k8s.io/apimachinery v0.0.0-20190221213512-86fb29eff628
k8s.io/client-go v0.0.0-20190228174230-b40b2a5939e4
k8s.io/klog v0.3.0 // indirect
k8s.io/kube-openapi v0.0.0-20190502190224-411b2483e503 // indirect
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7
k8s.io/api v0.0.0-20190511023547-e63b5755afac
k8s.io/apiextensions-apiserver v0.0.0-20190511064136-65be33f408e6 // indirect
k8s.io/apimachinery v0.0.0-20190511063452-5b67e417bf61
k8s.io/client-go v11.0.0+incompatible
k8s.io/kube-openapi v0.0.0-20190510232812-a01b7d5d6c22 // indirect
k8s.io/utils v0.0.0-20190506122338-8fab8cb257d5
sigs.k8s.io/controller-runtime v0.2.0-alpha.0
sigs.k8s.io/testing_frameworks v0.1.1
sigs.k8s.io/yaml v1.1.0
)

replace (
k8s.io/api => k8s.io/api v0.0.0-20190222213804-5cb15d344471
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190228180357-d002e88f6236
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190221213512-86fb29eff628
k8s.io/client-go => k8s.io/client-go v0.0.0-20190228174230-b40b2a5939e4
)

0 comments on commit e30df5d

Please sign in to comment.