Skip to content

Commit

Permalink
Issue minishift#214 Add basic application deployment testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
agajdosi committed Feb 19, 2018
1 parent bc3dc57 commit 399f521
Show file tree
Hide file tree
Showing 6 changed files with 404 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ build
*.ks
*.iso
tests/*.pyc
testing
vendor
239 changes: 239 additions & 0 deletions Gopkg.lock

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

37 changes: 37 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true

[[constraint]]
name = "github.com/DATA-DOG/godog"
version = "0.7.4"

[[constraint]]
name = "github.com/minishift/minishift"
version = "1.13.1"

[prune]
go-tests = true
unused-packages = true
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,32 @@ $(BIN_DIR)/minishift:
.PHONY: test
test: $(BIN_DIR)/minishift
sh tests/test.sh




# INTEGRATION TESTS
REPOPATH ?= github.com/minishift/minishift-centos-iso
TEST_DIR ?= $(CURDIR)/testing
INTEGRATION_TEST_DIR = $(TEST_DIR)/integration-test

# Platfrom dependency
ifeq ($(GOOS),windows)
IS_EXE := .exe
endif

# Integration tests
TIMEOUT ?= 3600s
MINISHIFT_BINARY ?= $(TEST_DIR)/bin/minishift$(IS_EXE)

# Make target definitions
.PHONY: integration
integration:
mkdir -p $(INTEGRATION_TEST_DIR)
MINISHIFT_ISO_URL=file://$(TEST_DIR)/iso/minishift-centos7.iso go test -timeout $(TIMEOUT) $(REPOPATH)/tests/integration --tags=integration -v -args --test-dir $(INTEGRATION_TEST_DIR) --binary $(MINISHIFT_BINARY) \
--run-before-feature="$(RUN_BEFORE_FEATURE)" --test-with-specified-shell="$(TEST_WITH_SPECIFIED_SHELL)" --tags=$(ADDON) $(GODOG_OPTS)

.PHONY: vendor
vendor:
dep ensure -v

33 changes: 33 additions & 0 deletions tests/integration/features/example.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@example

Feature: Minishift starts with CentOS iso

Scenario: Minishift can start with CentOS iso
When Minishift has state "Does Not Exist"
Then executing "minishift start" succeeds

Scenario: Minishift VM is using CentOS distribution
When executing "minishift ssh -- 'cat /etc/*-release'"
Then stdout should contain "CentOS Linux release"

Scenario Outline: User deploys, checks out and deletes several applications
Given Minishift has state "Running"
When executing "oc new-app <template-name>" succeeds
And executing "oc expose svc/<service-name>" succeeds
And executing "oc set probe dc/<service-name> --readiness --get-url=http://:8080<http-endpoint>" succeeds
And service "<service-name>" rollout successfully within "1200" seconds
Then with up to "10" retries with wait period of "500ms" the "body" of HTTP request to "<http-endpoint>" of service "<service-name>" in namespace "myproject" contains "<expected-hello>"
And with up to "10" retries with wait period of "500ms" the "status code" of HTTP request to "<http-endpoint>" of service "<service-name>" in namespace "myproject" is equal to "200"
And executing "oc delete all --all" succeeds

Examples: Required information to test the templates
| template-name | service-name | http-endpoint | expected-hello |
| https://github.com/openshift/ruby-ex.git | ruby-ex | / | Welcome to your Ruby application on OpenShift |
| https://github.com/openshift/nodejs-ex | nodejs-ex | / | Welcome to your Node.js application on OpenShift |
| https://github.com/openshift/django-ex.git | django-ex | / | Welcome to your Django application on OpenShift |
| https://github.com/openshift/dancer-ex.git | dancer-ex | / | Welcome to your Dancer application on OpenShift |
| https://github.com/openshift/cakephp-ex.git | cakephp-ex | / | Welcome to your CakePHP application on OpenShift |

Scenario: Deleting Minishift
When executing "minishift delete --force" succeeds
Then Minishift should have state "Does Not Exist"
Loading

0 comments on commit 399f521

Please sign in to comment.