Skip to content

Commit

Permalink
Install Hoverfly on devcontainer for virtual tests
Browse files Browse the repository at this point in the history
Also added and trusted the Hoverfly default certificate[1], so that
Hoverfly https calls work

And also set the tests to run in verbose mode in Visual Studio Code, so
we get more informative output when running them.

[1] https://raw.githubusercontent.com/SpectoLabs/hoverfly/master/core/cert.pem

https://hoverfly.readthedocs.io/
  • Loading branch information
johnboyes committed Jul 16, 2020
1 parent dd0ed6a commit 1160129
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ARG USER_GID=$USER_UID
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
# Need zip and unzip for the Hoverfly installation
&& apt-get -y install --no-install-recommends zip unzip \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install --no-install-recommends git openssh-client less iproute2 procps lsb-release \
Expand Down Expand Up @@ -63,3 +65,23 @@ RUN apt-get update \
# Updated from "auto" to "on" as we are using Go modules for this project
# See https://dev.to/maelvls/why-is-go111module-everywhere-and-everything-about-go-modules-24k
ENV GO111MODULE=on

# Install Hoverfly for virtualised tests: https://hoverfly.readthedocs.io/
# hadolint ignore=DL3003
RUN mkdir -p /tmp/hoverfly \
&& cd /tmp/hoverfly || exit \
&& export HOVERFLY_PLATFORM=linux_amd64 \
&& export HOVERFLY_PLATFORM=linux_amd64 \
&& export HOVERFLY_VERSION=v1.3.0 \
&& export HOVERFLY_BUNDLE=hoverfly_bundle_$HOVERFLY_PLATFORM \
&& wget https://github.com/SpectoLabs/hoverfly/releases/download/$HOVERFLY_VERSION/$HOVERFLY_BUNDLE.zip \
&& unzip $HOVERFLY_BUNDLE.zip \
&& mv hoverfly /usr/local/bin/ \
&& mv hoverctl /usr/local/bin/ \
&& chmod +x /usr/local/bin/hoverfly \
&& chmod +x /usr/local/bin/hoverctl \
# Add the trusted Hoverfly certificate so that Hoverfly SSL calls work
&& wget https://raw.githubusercontent.com/SpectoLabs/hoverfly/master/core/cert.pem \
&& cp cert.pem /usr/local/share/ca-certificates/hoverfly.crt \
&& update-ca-certificates \
&& rm -rf /tmp/hoverfly
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"go.lintOnSave": "file",
"go.testTimeout": "240s",
"go.testEnvFile": "${workspaceFolder}/.env",
"go.testFlags": ["-v"],

// "VSCode will complain about the "gopls" settings, but they will still work.
// Once we have a consistent set of settings, we will make the changes in the
Expand Down

0 comments on commit 1160129

Please sign in to comment.