Skip to content

Commit

Permalink
Merge pull request #318 from alphagov/186049138-postgresql-in-cf-acce…
Browse files Browse the repository at this point in the history
…ptance-tests

[186049138] Postgresql is used in acceptance tests
  • Loading branch information
dark5un committed Nov 30, 2023
2 parents c95d8a7 + cae4481 commit 9d7b912
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
31 changes: 17 additions & 14 deletions cf-acceptance-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM ghcr.io/alphagov/paas/ubuntu:main

RUN apt update \
&& apt install -y \
build-essential \
openssh-client \
unzip \
python3-pip \
jq \
git \
fossil \
mercurial \
bzr \
subversion
RUN wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc > /etc/apt/trusted.gpg.d/ACCC4CF8.asc \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN apt update && apt install -y \
build-essential \
openssh-client \
unzip \
python3-pip \
jq \
git \
fossil \
mercurial \
bzr \
subversion \
postgresql-12 \
postgresql-client-12

ENV GOPATH /go
ENV PATH /go/bin:/usr/local/go/bin:$PATH
Expand All @@ -30,8 +33,8 @@ RUN go install github.com/onsi/ginkgo/v2/ginkgo@latest

# Install the cf CLI
RUN wget -q -O cf.deb "https://packages.cloudfoundry.org/stable?release=debian64&version=${CF_CLI_VERSION}&source=github-rel" && \
dpkg -i cf.deb && \
rm -f cf.deb
dpkg -i cf.deb && \
rm -f cf.deb

# Setup plugins
ENV CF_PLUGIN_HOME /root/
Expand Down
11 changes: 11 additions & 0 deletions cf-acceptance-tests/cf-acceptance-tests_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'spec_helper'
require 'docker'
require 'serverspec'
require 'pathname'

GO_VERSION="1.21.1"
CF_CLI_VERSION="8.6.0"
Expand Down Expand Up @@ -58,6 +59,16 @@
).to eq(0)
end

it "has psql available" do
expect(
command("psql --version").exit_status
).to eq(0)
end

it "has postgresql startup script" do
expect(Pathname.new('/usr/bin/pg_ctlcluster')).to exist
end

it "has the CF_PLUGIN_HOME variable set" do
expect(
command("env").stdout
Expand Down

0 comments on commit 9d7b912

Please sign in to comment.