-
Notifications
You must be signed in to change notification settings - Fork 782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kkavish/compatibility test #1907
Closed
Closed
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a6230a6
- compatibility tests
kkavish 221cd6e
- compatibility tests
kkavish 6eb5cd9
Update README.md with consul compatibility results
kkavish ae7d449
Update README.md with consul compatibility results
kkavish 5066e8c
- compatibility tests
kkavish 43ef3b4
Merge remote-tracking branch 'origin/kkavish/compatibility-test' into…
kkavish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ARG CONSUL_IMAGE_NAME=hashicorp/consul | ||
ARG CONSUL_IMAGE_VERSION=1.17.1 | ||
|
||
ARG VAULT_IMAGE_NAME=hashicorp/vault | ||
ARG VAULT_IMAGE_VERSION=1.16 | ||
|
||
ARG NOMAD_IMAGE_NAME=hashicorp/nomad | ||
ARG NOMAD_IMAGE_VERSION=1.7 | ||
|
||
FROM ${CONSUL_IMAGE_NAME}:${CONSUL_IMAGE_VERSION} as consul | ||
FROM ${VAULT_IMAGE_NAME}:${VAULT_IMAGE_VERSION} as vault | ||
FROM ${NOMAD_IMAGE_NAME}:${NOMAD_IMAGE_VERSION} as nomad | ||
FROM ubuntu:22.04 | ||
|
||
ARG CONSUL_TEMPLATE_TAG=v0.37.4 | ||
ARG GO_VERSION=1.22.1 | ||
ARG OS_ARCH=linux-amd64 | ||
|
||
RUN apt-get update -y -q && apt-get upgrade -y -q && \ | ||
apt-get install tar git wget make rsyslog sudo curl -y && \ | ||
curl -sSL https://get.docker.com/ | sh | ||
|
||
RUN rm -rf /usr/local/go && wget https://go.dev/dl/go${GO_VERSION}.${OS_ARCH}.tar.gz && tar -C /usr/local -xzf go${GO_VERSION}.${OS_ARCH}.tar.gz | ||
|
||
RUN git clone https://github.com/hashicorp/consul-template.git | ||
RUN cd consul-template && git fetch --all --tags && git checkout tags/${CONSUL_TEMPLATE_TAG} -b ${CONSUL_TEMPLATE_TAG}-branch | ||
|
||
COPY --from=consul /bin/consul /bin/consul | ||
COPY --from=vault /bin/vault /bin/vault | ||
COPY --from=nomad /bin/nomad /bin/nomad | ||
|
||
ADD rsyslog.conf /etc/rsyslog.conf | ||
ADD run_tests.sh /run_tests.sh | ||
ADD run_nomad.sh /run_nomad.sh | ||
|
||
RUN chmod +x /run_tests.sh | ||
RUN chmod +x /run_nomad.sh | ||
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf | ||
|
||
WORKDIR /consul-template | ||
|
||
ENV PATH="${PATH}:/bin:/usr/local/go/bin:/usr/local/go/src" | ||
ENV GOPRIVATE="github.com/hashicorp/*" | ||
|
||
CMD ["/run_tests.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
CONSUL_CE_IMAGE = hashicorp/consul | ||
CONSUL_CE_VERSIONS = 1.18 1.17 1.16 1.15 | ||
|
||
CONSUL_ENT_IMAGE = hashicorp/consul-enterprise | ||
CONSUL_ENT_VERSIONS = 1.17-ent 1.16-ent 1.15-ent | ||
|
||
CONSUL_TEMPLATE_TAG = v0.34.0 | ||
|
||
build-ce-images: | ||
@echo "==> running build-ce-images" | ||
for version in $(CONSUL_CE_VERSIONS); do \ | ||
docker build -t ct-consul-compat-$$version \ | ||
--build-arg CONSUL_IMAGE_VERSION=$$version \ | ||
--build-arg CONSUL_IMAGE_NAME=${CONSUL_CE_IMAGE} \ | ||
--build-arg CONSUL_TEMPLATE_TAG=${CONSUL_TEMPLATE_TAG} \ | ||
--no-cache .; \ | ||
done | ||
|
||
.PHONY: .build-ce-images | ||
|
||
build-ent-images: | ||
@echo "==> running build-ent-images" | ||
for version in $(CONSUL_ENT_VERSIONS); do \ | ||
docker build -t ct-consul-compat-$$version \ | ||
--build-arg CONSUL_IMAGE_VERSION=$$version \ | ||
--build-arg CONSUL_IMAGE_NAME=${CONSUL_ENT_IMAGE} \ | ||
--build-arg CONSUL_TEMPLATE_TAG=${CONSUL_TEMPLATE_TAG} \ | ||
--no-cache .; \ | ||
done | ||
|
||
.PHONY: .build-ent-images | ||
|
||
test-compat-ce: | ||
@echo "==> running test-compat-ce" | ||
for version in $(CONSUL_CE_VERSIONS); do \ | ||
docker run --privileged --init ct-consul-compat-$$version; \ | ||
done | ||
|
||
.PHONY: test-compat-ce | ||
|
||
test-compat-ent: | ||
@echo "==> running test-compat-ent" | ||
for version in $(CONSUL_ENT_VERSIONS); do \ | ||
docker run --privileged -e CONSUL_LICENSE=$(CONSUL_LICENSE) --init ct-consul-compat-$$version; \ | ||
done | ||
|
||
.PHONY: test-compat-ent | ||
|
||
test-compat: | ||
@echo "==> running run" | ||
build-ce-images | ||
test-compat-ce | ||
build-ent-images | ||
test-compat-ent | ||
done | ||
|
||
.PHONY: test-compat | ||
|
||
clean: | ||
@echo "==> running clean" | ||
docker system prune | ||
|
||
.PHONY: clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Run Consul Template Compatibility Tests | ||
|
||
## Prerequisites | ||
|
||
### Check whether the cgroup2 filesystem is mounted with following mount configuration: | ||
```mount | grep cgroup``` | ||
|
||
### If not, mount the cgroup2 filesystem with the following command: | ||
```sudo mount -t cgroup2 -o rw,nosuid,nodev,noexec,relatime,memory_recursiveprot none /sys/fs/cgroup``` | ||
|
||
## How to run the compatibility tests | ||
1. Update the versions of Consul and tag of Consul Template in Makefile. For ENT builds, set an env variable `CONSUL_LICENSE` before running the commands. | ||
2. Run the following command: | ||
```shell | ||
cd compatibility_tests | ||
make test-compat | ||
``` | ||
3. The test results will be displayed on the console. | ||
4. If the tests fail, check the container for the logs. | ||
5. To clean up the containers, run the following command: | ||
```shell | ||
make clean | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# /etc/rsyslog.conf configuration file for rsyslog | ||
# | ||
# For more information install rsyslog-doc and see | ||
# /usr/share/doc/rsyslog-doc/html/configuration/index.html | ||
# | ||
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf | ||
|
||
|
||
################# | ||
#### MODULES #### | ||
################# | ||
|
||
module(load="imuxsock") # provides support for local system logging | ||
#module(load="immark") # provides --MARK-- message capability | ||
|
||
# provides UDP syslog reception | ||
#module(load="imudp") | ||
#input(type="imudp" port="514") | ||
|
||
# provides TCP syslog reception | ||
#module(load="imtcp") | ||
#input(type="imtcp" port="514") | ||
|
||
# provides kernel logging support and enable non-kernel klog messages | ||
module(load="imklog" permitnonkernelfacility="on") | ||
|
||
########################### | ||
#### GLOBAL DIRECTIVES #### | ||
########################### | ||
|
||
# | ||
# Use traditional timestamp format. | ||
# To enable high precision timestamps, comment out the following line. | ||
# | ||
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat | ||
|
||
# Filter duplicated messages | ||
$RepeatedMsgReduction on | ||
|
||
# | ||
# Set the default permissions for all log files. | ||
# | ||
$FileOwner syslog | ||
$FileGroup adm | ||
$FileCreateMode 0640 | ||
$DirCreateMode 0755 | ||
$Umask 0022 | ||
$PrivDropToUser syslog | ||
$PrivDropToGroup syslog | ||
|
||
# | ||
# Where to place spool and state files | ||
# | ||
$WorkDirectory /var/spool/rsyslog | ||
|
||
# | ||
# Include all config files in /etc/rsyslog.d/ | ||
# | ||
$IncludeConfig /etc/rsyslog.d/*.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
sudo mkdir /sys/fs/cgroup/init && \ | ||
for p in `cat /sys/fs/cgroup/cgroup.procs`; do echo $p | sudo tee /sys/fs/cgroup/init/cgroup.procs || true; done | ||
|
||
dockerd & | ||
rsyslogd -n & | ||
|
||
go test -count=1 -timeout=30s -parallel=20 -tags="${GOTAGS}" `go list ./... | grep -v github.com/hashicorp/consul-template/watch | grep -v github.com/hashicorp/consul-template/version` ${TESTARGS} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script doesn't appear to exist