Skip to content

Add test/check sanity to check if test-framework mock data is updated #2131

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

Merged
merged 4 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ tidy: ## Update dependencies
clean: ## Clean up the build artifacts
$(Q)rm -rf build

cli-doc: ## Generate CLI Documentation
./hack/doc/gen_cli_doc.sh
gen-cli-doc: ## Generate CLI documentation
./hack/generate/gen-cli-doc.sh

gen-test-framework: install ## Run generate commands to update test/test-framework
./hack/generate/gen-test-framework.sh

generate: gen-cli-doc gen-test-framework ## Run all generate targets
.PHONY: generate gen-cli-doc gen-test-framework

# Build/install/release the SDK.
.PHONY: install release_builds release
Expand Down Expand Up @@ -112,7 +118,7 @@ test: test-unit ## Run the tests
test-markdown test/markdown:
./hack/ci/marker

test-sanity test/sanity: tidy
test-sanity test/sanity: tidy build/operator-sdk
./hack/tests/sanity-check.sh

test-unit test/unit: ## Run the unit tests
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
github.com/ghodss/yaml v1.0.1-0.20180820084758-c7ce16629ff4
github.com/go-logr/logr v0.1.0
github.com/go-logr/zapr v0.1.1
github.com/go-openapi/spec v0.19.0
github.com/gobuffalo/packr v1.30.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/huandu/xstrings v1.2.0 // indirect
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions hack/doc/gen_cli_doc.sh

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions hack/generate/gen-cli-doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

go run ./hack/generate/gen-cli-doc.go
30 changes: 30 additions & 0 deletions hack/generate/gen-test-framework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

#############################
# Make sure that test/test-framework is updated according to the current source code
#############################

set -ex

source hack/lib/test_lib.sh

# Define vars
DOCKERFILE="build/Dockerfile"

# Go inside of the mock data test project
cd test/test-framework

# Create the required files in the mock test/test-framework just to allow run from it the oprator-sdk commands
echo > $DOCKERFILE
go mod init test-framework

# Remove files that are required and created just to exec the commands.
trap_add 'rm -rf $DOCKERFILE go.mod go.sum' EXIT

# Run gen commands
../../build/operator-sdk generate k8s
../../build/operator-sdk generate openapi

# TODO(camilamacedo86): remove this when the openapi gen be set to false and it no longer is generated
# The following file is gen by openapi but it has not been committed in order to allow we clone and call the test locally in any path.
trap_add 'rm pkg/apis/cache/v1alpha1/zz_generated.openapi.go' EXIT
7 changes: 4 additions & 3 deletions hack/tests/sanity-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ go mod tidy
go vet ./...
go fmt ./...

./hack/check_license.sh
./hack/check_error_log_msg_format.sh
./hack/doc/gen_cli_doc.sh
./hack/check-license.sh
./hack/check-error-log-msg-format.sh
./hack/generate/gen-cli-doc.sh
./hack/generate/gen-test-framework.sh

# Make sure repo is still in a clean state.
git diff --exit-code
221 changes: 0 additions & 221 deletions test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.openapi.go

This file was deleted.