Skip to content

Commit

Permalink
*: Clean test invocation and documenation
Browse files Browse the repository at this point in the history
- Remove outdated `e2e-clean` and `run-docker-test-minikube` Makefile
target from Tectonic times.

- Clean up Makefile Phony entries.

- Remove `--operator-image` flag for end-to-end test invocation. This
flag is not used anymore and can't be inferred from the repository at
hand.

- Update `README.md` `## Testing` section.
  • Loading branch information
mxinden committed Feb 26, 2019
1 parent ebb0183 commit 953da94
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 28 deletions.
19 changes: 4 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,14 @@ $(JSONNET_BIN):
test-unit:
go test $(PKGS)

vendor:
govendor add +external

test-e2e:
go test -v -timeout=20m ./test/e2e/ --operator-image=$(REPO):$(TAG) --kubeconfig $(KUBECONFIG)

e2e-clean:
kubectl -n $(NAMESPACE) delete appversion,prometheus,alertmanager,servicemonitor,statefulsets,deploy,svc,endpoints,pods,cm,secrets,replicationcontrollers,thirdpartyresource --all --ignore-not-found
kubectl delete namespace $(NAMESPACE)
go test -v -timeout=20m ./test/e2e/ --kubeconfig $(KUBECONFIG)

build-docker-test:
sed 's/DOCKER_IMAGE_TAG/$(TAG)/' Dockerfile.test > Dockerfile.test.generated
docker build -f Dockerfile.test.generated -t quay.io/coreos/cluster-monitoring-operator-test:$(TAG) .

run-docker-test-minikube:
docker run --rm -it --env KUBECONFIG=/kubeconfig -v /home/$(USER)/.kube/config:/kubeconfig -v /home/$(USER)/.minikube:/home/$(USER)/.minikube quay.io/coreos/cluster-monitoring-operator-test:$(TAG)
vendor:
govendor add +external

merge-cluster-roles: manifests/02-role.yaml
manifests/02-role.yaml: $(ASSETS) hack/merge_cluster_roles.py hack/cluster-monitoring-operator-role.yaml.in
python2 hack/merge_cluster_roles.py hack/cluster-monitoring-operator-role.yaml.in `find assets | grep role | grep -v "role-binding" | sort` > manifests/02-role.yaml

.PHONY: all build operator-no-deps run crossbuild container push clean deps generate dependencies test e2e-test e2e-clean merge-cluster-roles
.PHONY: all build operator-no-deps run crossbuild container push clean deps generate dependencies test test-e2e merge-cluster-roles
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Run `make pkg/manifests/bindata.go` after you modify the files and make sure to

## Testing

### End-to-end tests
- **Unit tests**: `make test-unit`

Run e2e-tests with `make e2e-test`.
Clean up after e2e-tests with `make e2e-clean`
- **End-to-end tests**: `make test-e2e`
4 changes: 1 addition & 3 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ type Framework struct {

MonitoringClient *monClient.MonitoringV1Client
Ns string
OpImageName string
}

func New(kubeConfigPath string, opImageName string) (*Framework, error) {
func New(kubeConfigPath string) (*Framework, error) {
config, err := clientcmd.BuildConfigFromFlags("", kubeConfigPath)
if err != nil {
return nil, err
Expand Down Expand Up @@ -84,7 +83,6 @@ func New(kubeConfigPath string, opImageName string) (*Framework, error) {
CRDClient: crdClient,
MonitoringClient: mClient,
Ns: namespaceName,
OpImageName: opImageName,
}

return f, nil
Expand Down
8 changes: 1 addition & 7 deletions test/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,10 @@ func testMain(m *testing.M) int {
"kube config path, default: $HOME/.kube/config",
)

opImageName := flag.String(
"operator-image",
"",
"operator image, e.g. quay.io/coreos/cluster-monitoring-operator",
)

flag.Parse()

var err error
f, err = framework.New(*kubeConfigPath, *opImageName)
f, err = framework.New(*kubeConfigPath)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 953da94

Please sign in to comment.