Skip to content

Commit

Permalink
Integration tests for puppet module
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyc-splunk committed May 17, 2021
1 parent aec0271 commit ca3a3a1
Show file tree
Hide file tree
Showing 16 changed files with 547 additions and 8 deletions.
52 changes: 51 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ workflows:
filters:
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+.*/
- puppet-test:
filters:
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+.*/

jobs:
setup-environment:
Expand Down Expand Up @@ -481,7 +485,7 @@ jobs:
name: Check for relevant changes
command: |
# Only run installer tests for main branch, tags, or if the branch has relevant changes
if [[ "$CIRCLE_BRANCH" != "main" ]] && [[ -z "${CIRCLE_TAG:-}" ]] && ! .circleci/scripts/changes-include internal/buildscripts/packaging; then
if [[ "$CIRCLE_BRANCH" != "main" ]] && [[ -z "${CIRCLE_TAG:-}" ]] && ! .circleci/scripts/changes-include internal/buildscripts/packaging/installer internal/buildscripts/packaging/tests; then
echo "SKIP_TESTS=yes" >> $BASH_ENV
fi
- install_pytest
Expand Down Expand Up @@ -537,3 +541,49 @@ jobs:
$msi_path = Resolve-Path .\dist\splunk-otel-collector*.msi
$env:VERIFY_ACCESS_TOKEN = "false"
.\internal\buildscripts\packaging\installer\install.ps1 -access_token "testing123" -msi_path "$msi_path" -mode "<< parameters.mode >>"
puppet-test:
machine:
image: ubuntu-1604:202007-01
docker_layer_caching: true
parallelism: 2
steps:
- checkout
- run:
name: Lint
command: |
# Only run lint for main branch, tags, or if the branch has relevant changes
if [[ "$CIRCLE_BRANCH" = "main" ]] || [[ -n "${CIRCLE_TAG:-}" ]] || .circleci/scripts/changes-include deployments/puppet; then
make -C deployments/puppet lint
fi
- run:
name: Rake spec
command: |
# Only run rake-spec for main branch, tags, or if the branch has relevant changes
if [[ "$CIRCLE_BRANCH" = "main" ]] || [[ -n "${CIRCLE_TAG:-}" ]] || .circleci/scripts/changes-include deployments/puppet; then
make -C deployments/puppet rake-spec
fi
- run:
name: Check for relevant changes
command: |
# Only run puppet tests for main branch, tags, or if the branch has relevant changes
if [[ "$CIRCLE_BRANCH" != "main" ]] && [[ -z "${CIRCLE_TAG:-}" ]] && ! .circleci/scripts/changes-include deployments/puppet internal/buildscripts/packaging/tests; then
echo "SKIP_TESTS=yes" >> $BASH_ENV
fi
- install_pytest
- run:
name: Test puppet module
command: |
[[ "$SKIP_TESTS" = "yes" ]] && exit 0
mkdir -p ~/testresults
if [[ $CIRCLE_NODE_INDEX -eq 0 ]]; then
PACKAGE_TYPE=deb
else
PACKAGE_TYPE=rpm
fi
pytest -n2 --verbose -m $PACKAGE_TYPE \
--junitxml=~/testresults/results.xml \
--html=~/testresults/results.html \
--self-contained-html \
internal/buildscripts/packaging/tests/deployments/puppet/puppet_test.py
- save_pytest_results
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM debian:buster

RUN apt-get update &&\
apt-get install -yq ca-certificates procps systemd wget apt-transport-https libcap2-bin curl gnupg lsb-release

ARG PUPPET_RELEASE="6"
RUN wget https://apt.puppetlabs.com/puppet${PUPPET_RELEASE}-release-buster.deb && \
dpkg -i puppet${PUPPET_RELEASE}-release-buster.deb && \
apt-get update && \
apt-get install -y puppet-agent

ENV PATH=/opt/puppetlabs/bin:$PATH

ENV container docker

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \
"systemd-tmpfiles-setup.service" ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/anaconda.target.wants/*;

# Keep it from wiping our scratch dir in /tmp/scratch
RUN rm -f /usr/lib/tmpfiles.d/tmp.conf;

RUN systemctl set-default multi-user.target
ENV init /lib/systemd/systemd

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppetlabs-apt --version 7.0.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

VOLUME [ "/sys/fs/cgroup" ]

CMD ["/sbin/init"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM debian:jessie

RUN apt-get update &&\
apt-get install -yq ca-certificates procps systemd wget apt-transport-https libcap2-bin curl gnupg lsb-release

ARG PUPPET_RELEASE="6"
RUN wget https://apt.puppetlabs.com/puppet${PUPPET_RELEASE}-release-jessie.deb && \
dpkg -i puppet${PUPPET_RELEASE}-release-jessie.deb && \
apt-get update && \
apt-get install -y puppet-agent

ENV PATH=/opt/puppetlabs/bin:$PATH

ENV container docker

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \
"systemd-tmpfiles-setup.service" ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/anaconda.target.wants/*;

# Keep it from wiping our scratch dir in /tmp/scratch
RUN rm -f /usr/lib/tmpfiles.d/tmp.conf;

RUN systemctl set-default multi-user.target
ENV init /lib/systemd/systemd

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppetlabs-apt --version 7.0.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

VOLUME [ "/sys/fs/cgroup" ]

CMD ["/sbin/init"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM debian:stretch

RUN apt-get update &&\
apt-get install -yq ca-certificates procps systemd wget apt-transport-https libcap2-bin curl gnupg lsb-release

ARG PUPPET_RELEASE="6"
RUN wget https://apt.puppetlabs.com/puppet${PUPPET_RELEASE}-release-stretch.deb && \
dpkg -i puppet${PUPPET_RELEASE}-release-stretch.deb && \
apt-get update && \
apt-get install -y puppet-agent

ENV PATH=/opt/puppetlabs/bin:$PATH

ENV container docker

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \
"systemd-tmpfiles-setup.service" ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/anaconda.target.wants/*;

# Keep it from wiping our scratch dir in /tmp/scratch
RUN rm -f /usr/lib/tmpfiles.d/tmp.conf;

RUN systemctl set-default multi-user.target
ENV init /lib/systemd/systemd

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppetlabs-apt --version 7.0.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

VOLUME [ "/sys/fs/cgroup" ]

ENTRYPOINT ["/lib/systemd/systemd"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ubuntu:18.04

RUN apt-get update &&\
apt-get install -yq ca-certificates procps systemd wget apt-transport-https libcap2-bin curl gnupg lsb-release

ARG PUPPET_RELEASE="6"
RUN wget https://apt.puppetlabs.com/puppet${PUPPET_RELEASE}-release-bionic.deb && \
dpkg -i puppet${PUPPET_RELEASE}-release-bionic.deb && \
apt-get update && \
apt-get install -y puppet-agent

ENV PATH=/opt/puppetlabs/bin:$PATH

ENV container docker

RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
/etc/systemd/system/*.wants/* \
/lib/systemd/system/local-fs.target.wants/* \
/lib/systemd/system/sockets.target.wants/*udev* \
/lib/systemd/system/sockets.target.wants/*initctl* \
/lib/systemd/system/systemd-update-utmp*

RUN systemctl set-default multi-user.target
ENV init /lib/systemd/systemd

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppetlabs-apt --version 7.0.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

VOLUME [ "/sys/fs/cgroup" ]

ENTRYPOINT ["/lib/systemd/systemd"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ubuntu:20.04

RUN apt-get update &&\
apt-get install -yq ca-certificates procps systemd wget apt-transport-https libcap2-bin curl gnupg lsb-release

ARG PUPPET_RELEASE="6"
RUN wget https://apt.puppetlabs.com/puppet${PUPPET_RELEASE}-release-focal.deb && \
dpkg -i puppet${PUPPET_RELEASE}-release-focal.deb && \
apt-get update && \
apt-get install -y puppet-agent

ENV PATH=/opt/puppetlabs/bin:$PATH

ENV container docker

RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
/etc/systemd/system/*.wants/* \
/lib/systemd/system/local-fs.target.wants/* \
/lib/systemd/system/sockets.target.wants/*udev* \
/lib/systemd/system/sockets.target.wants/*initctl* \
/lib/systemd/system/systemd-update-utmp*

RUN systemctl set-default multi-user.target
ENV init /lib/systemd/systemd

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppetlabs-apt --version 7.0.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

VOLUME [ "/sys/fs/cgroup" ]

ENTRYPOINT ["/lib/systemd/systemd"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ubuntu:16.04

RUN apt-get update &&\
apt-get install -yq ca-certificates procps systemd wget apt-transport-https libcap2-bin curl gnupg lsb-release

ARG PUPPET_RELEASE="6"
RUN wget https://apt.puppetlabs.com/puppet${PUPPET_RELEASE}-release-xenial.deb && \
dpkg -i puppet${PUPPET_RELEASE}-release-xenial.deb && \
apt-get update && \
apt-get install -y puppet-agent

ENV PATH=/opt/puppetlabs/bin:$PATH

ENV container docker

RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
/etc/systemd/system/*.wants/* \
/lib/systemd/system/local-fs.target.wants/* \
/lib/systemd/system/sockets.target.wants/*udev* \
/lib/systemd/system/sockets.target.wants/*initctl* \
/lib/systemd/system/systemd-update-utmp*

RUN systemctl set-default multi-user.target
ENV init /lib/systemd/systemd

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppetlabs-apt --version 7.0.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

VOLUME [ "/sys/fs/cgroup" ]

ENTRYPOINT ["/lib/systemd/systemd"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM amazonlinux:2

ENV container docker

RUN yum install -y systemd procps initscripts

ARG PUPPET_RELEASE="6"
RUN rpm -Uvh https://yum.puppet.com/puppet${PUPPET_RELEASE}-release-el-7.noarch.rpm && \
yum install -y puppet-agent

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \
"systemd-tmpfiles-setup.service" ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;

VOLUME [ "/sys/fs/cgroup" ]

ENV PATH=/opt/puppetlabs/bin:$PATH

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppet-yum --version 4.3.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

CMD ["/usr/sbin/init"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM centos:7

ENV container docker

RUN yum install -y systemd procps initscripts

ARG PUPPET_RELEASE="6"
RUN rpm -Uvh https://yum.puppet.com/puppet${PUPPET_RELEASE}-release-el-7.noarch.rpm && \
yum install -y puppet-agent

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \
"systemd-tmpfiles-setup.service" ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;

VOLUME [ "/sys/fs/cgroup" ]

ENV PATH=/opt/puppetlabs/bin:$PATH

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppet-yum --version 4.3.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

CMD ["/usr/sbin/init"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM centos:8

ENV container docker

RUN dnf install -y systemd procps initscripts

ARG PUPPET_RELEASE="6"
RUN rpm -Uvh https://yum.puppet.com/puppet${PUPPET_RELEASE}-release-el-8.noarch.rpm && \
dnf install -y puppet-agent

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \
"systemd-tmpfiles-setup.service" ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;

VOLUME [ "/sys/fs/cgroup" ]

ENV PATH=/opt/puppetlabs/bin:$PATH

RUN puppet module install puppetlabs-stdlib --version 4.24.0
RUN puppet module install puppet-yum --version 4.3.0

COPY deployments/puppet /etc/puppetlabs/code/environments/production/modules/splunk_otel_collector

CMD ["/usr/sbin/init"]
Loading

0 comments on commit ca3a3a1

Please sign in to comment.