Skip to content

Commit 19ba764

Browse files
Merge pull request #34 from banzaicloud/restructure-tests
refactor: restructure tests
2 parents a5898ba + 1fa218c commit 19ba764

File tree

8 files changed

+606
-407
lines changed

8 files changed

+606
-407
lines changed

.circleci/config.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ integration-test-base: &integration-test-base
5353
- restore_cache:
5454
name: Restore Go module cache
5555
keys:
56-
- gomod-v2-{{ .Branch }}-{{ checksum "go.sum" }}
56+
- gomod-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
5757
- gomod-v2-{{ .Branch }}
5858
- gomod-v2-master
5959
- gomod-v2
@@ -102,25 +102,27 @@ jobs:
102102
- restore_cache:
103103
name: Restore Go module cache
104104
keys:
105-
- gomod-v2-{{ .Branch }}-{{ checksum "go.sum" }}
105+
- gomod-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
106106
- gomod-v2-{{ .Branch }}
107107
- gomod-v2-master
108108
- gomod-v2
109109

110110
- run:
111111
name: Install dependencies
112-
command: go mod download
112+
command: |
113+
cd tests
114+
go mod download
113115
114116
- save_cache:
115117
name: Save Go module cache
116-
key: gomod-v2-{{ .Branch }}-{{ checksum "go.sum" }}
118+
key: gomod-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
117119
paths:
118120
- /go/pkg/mod
119121

120122
- restore_cache:
121123
name: Restore license cache
122124
keys:
123-
- licensei-v2-{{ .Branch }}-{{ checksum "go.sum" }}
125+
- licensei-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
124126
- licensei-v2-{{ .Branch }}
125127
- licensei-v2-master
126128
- licensei-v2
@@ -131,7 +133,7 @@ jobs:
131133

132134
- save_cache:
133135
name: Save license cache
134-
key: licensei-v2-{{ .Branch }}-{{ checksum "go.sum" }}
136+
key: licensei-v2-{{ .Branch }}-{{ checksum "tests/go.sum" }}
135137
paths:
136138
- .licensei.cache
137139

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
LICENSEI_VERSION = 0.1.0
22
GOLANGCI_VERSION = 1.16.0
33

4-
all: license fmt vet
4+
all: license fmt vet test
55

66
.PHONY: license
77
license:
@@ -15,8 +15,11 @@ fmt:
1515
vet:
1616
go vet ./...
1717

18+
test:
19+
go test ./...
20+
1821
test-integration:
19-
go test -integration -v ./...
22+
cd tests && go test -integration -v ./...
2023

2124
bin/licensei: bin/licensei-${LICENSEI_VERSION}
2225
@ln -sf licensei-${LICENSEI_VERSION} bin/licensei

go.mod

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ go 1.13
44

55
require (
66
emperror.dev/errors v0.8.0
7-
github.com/imdario/mergo v0.3.7 // indirect
87
github.com/json-iterator/go v1.1.10
98
k8s.io/api v0.19.2
10-
k8s.io/apiextensions-apiserver v0.19.2
119
k8s.io/apimachinery v0.19.2
12-
k8s.io/client-go v0.19.2
13-
k8s.io/klog/v2 v2.3.0
1410
)

go.sum

Lines changed: 0 additions & 393 deletions
Large diffs are not rendered by default.

tests/go.mod

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module github.com/banzaicloud/k8s-objectmatcher/tests
2+
3+
go 1.13
4+
5+
require (
6+
emperror.dev/errors v0.8.0
7+
github.com/banzaicloud/k8s-objectmatcher v1.4.1
8+
k8s.io/api v0.19.2
9+
k8s.io/apiextensions-apiserver v0.19.2
10+
k8s.io/apimachinery v0.19.2
11+
k8s.io/client-go v0.19.2
12+
k8s.io/klog/v2 v2.3.0
13+
)
14+
15+
replace github.com/banzaicloud/k8s-objectmatcher => ../

tests/go.sum

Lines changed: 576 additions & 0 deletions
Large diffs are not rendered by default.

integration_test.go renamed to tests/integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
package objectmatch
14+
package tests
1515

1616
import (
1717
"log"

main_test.go renamed to tests/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
package objectmatch
14+
package tests
1515

1616
import (
1717
"context"

0 commit comments

Comments
 (0)