Skip to content

Commit

Permalink
Merge pull request #34 from banzaicloud/restructure-tests
Browse files Browse the repository at this point in the history
refactor: restructure tests
  • Loading branch information
sagikazarmark authored Oct 3, 2020
2 parents a5898ba + 1fa218c commit 19ba764
Show file tree
Hide file tree
Showing 8 changed files with 606 additions and 407 deletions.
14 changes: 8 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ integration-test-base: &integration-test-base
- restore_cache:
name: Restore Go module cache
keys:
- gomod-v2-{{ .Branch }}-{{ checksum "go.sum" }}
- gomod-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
- gomod-v2-{{ .Branch }}
- gomod-v2-master
- gomod-v2
Expand Down Expand Up @@ -102,25 +102,27 @@ jobs:
- restore_cache:
name: Restore Go module cache
keys:
- gomod-v2-{{ .Branch }}-{{ checksum "go.sum" }}
- gomod-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
- gomod-v2-{{ .Branch }}
- gomod-v2-master
- gomod-v2

- run:
name: Install dependencies
command: go mod download
command: |
cd tests
go mod download
- save_cache:
name: Save Go module cache
key: gomod-v2-{{ .Branch }}-{{ checksum "go.sum" }}
key: gomod-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
paths:
- /go/pkg/mod

- restore_cache:
name: Restore license cache
keys:
- licensei-v2-{{ .Branch }}-{{ checksum "go.sum" }}
- licensei-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
- licensei-v2-{{ .Branch }}
- licensei-v2-master
- licensei-v2
Expand All @@ -131,7 +133,7 @@ jobs:

- save_cache:
name: Save license cache
key: licensei-v2-{{ .Branch }}-{{ checksum "go.sum" }}
key: licensei-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
paths:
- .licensei.cache

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LICENSEI_VERSION = 0.1.0
GOLANGCI_VERSION = 1.16.0

all: license fmt vet
all: license fmt vet test

.PHONY: license
license:
Expand All @@ -15,8 +15,11 @@ fmt:
vet:
go vet ./...

test:
go test ./...

test-integration:
go test -integration -v ./...
cd tests && go test -integration -v ./...

bin/licensei: bin/licensei-${LICENSEI_VERSION}
@ln -sf licensei-${LICENSEI_VERSION} bin/licensei
Expand Down
4 changes: 0 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ go 1.13

require (
emperror.dev/errors v0.8.0
github.com/imdario/mergo v0.3.7 // indirect
github.com/json-iterator/go v1.1.10
k8s.io/api v0.19.2
k8s.io/apiextensions-apiserver v0.19.2
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.2
k8s.io/klog/v2 v2.3.0
)
393 changes: 0 additions & 393 deletions go.sum

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions tests/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module github.com/banzaicloud/k8s-objectmatcher/tests

go 1.13

require (
emperror.dev/errors v0.8.0
github.com/banzaicloud/k8s-objectmatcher v1.4.1
k8s.io/api v0.19.2
k8s.io/apiextensions-apiserver v0.19.2
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.2
k8s.io/klog/v2 v2.3.0
)

replace github.com/banzaicloud/k8s-objectmatcher => ../
576 changes: 576 additions & 0 deletions tests/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration_test.go → tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package objectmatch
package tests

import (
"log"
Expand Down
2 changes: 1 addition & 1 deletion main_test.go → tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package objectmatch
package tests

import (
"context"
Expand Down

0 comments on commit 19ba764

Please sign in to comment.