Skip to content

Commit

Permalink
Fixed up the acceptance tests
Browse files Browse the repository at this point in the history
We no longer need the manual docker image nor the odd makefile. We now
also collect the result files.
  • Loading branch information
sgnn7 committed Dec 6, 2018
1 parent 6e8bba5 commit 249d9d7
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 19 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output/
output/**/*
dist/
acceptance/tmp
*.tmp
Expand All @@ -18,6 +18,10 @@ Godeps/
# Vim editor tempfiles
*.sw[po]

# Keep of force-saved dirs
# TODO: Figure out why Jenkins can't create dirs for these
!**/.keep

# Created by https://www.gitignore.io

### OSX ###
Expand Down
9 changes: 5 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ test-unit:

test-acceptance:
stage: test
dependencies:
- build
script:
- cp ./dist/linux_amd64/summon summon
- cd acceptance && make
- ./test_acceptance
artifacts:
paths:
- output/acceptance/*.xml

test-installer-ubuntu1404:
stage: test
script:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Changed
- Updated codebase to use [go v1.11 modules](https://github.com/golang/go/wiki/Modules).
- Updated acceptance tests to use an automated test image builds and no makefiles.

## [v0.6.8](https://github.com/cyberark/summon/releases/tag/v0.6.8) - 2018-09-14
### Added
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile.acceptance
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:1.11-alpine

RUN apk add --no-cache bash \
build-base \
git \
libffi-dev \
ruby-bundler \
ruby-dev

# Install summon prerequisites
WORKDIR /summon
COPY go.mod go.sum ./
RUN go mod download

# Install test (Ruby) prerequisites
WORKDIR /summon/acceptance
COPY acceptance/Gemfile acceptance/Gemfile.lock ./
RUN bundle install

# Build summon
WORKDIR /summon
COPY . .
RUN go build -o /bin/summon cmd/main.go

# Run tests
WORKDIR /summon/acceptance
CMD ["cucumber"]
9 changes: 2 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ pipeline {

stage('Run acceptance tests') {
steps {
sh 'cp ./dist/linux_amd64/summon summon'
dir('acceptance') {
sh 'make'
}
// TODO: remove need to sudo here
sh 'sudo chown -R jenkins:jenkins .'
// TODO: collect the acceptance test results
sh './test_acceptance'
junit 'output/acceptance/*.xml'
}
}

Expand Down
7 changes: 0 additions & 7 deletions acceptance/Makefile

This file was deleted.

Empty file added output/acceptance/.keep
Empty file.
14 changes: 14 additions & 0 deletions test_acceptance
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -e

OUTPUT_DIR="$PWD/output/acceptance"

rm -f "$OUTPUT_DIR/*.xml"

echo "Running acceptance tests"
docker build --pull -t summon-acceptance -f Dockerfile.acceptance .

docker run --rm -t \
-v "$OUTPUT_DIR:/summon/acceptance/output" \
summon-acceptance bash -c 'cucumber --format junit --out ./output'

echo "Results are in $OUTPUT_DIR"

0 comments on commit 249d9d7

Please sign in to comment.