Skip to content

Commit 7ed1f67

Browse files
authored
chore: Add initial e2e test infrastructure (argoproj-labs#358)
* This is a first throw at integrating an e2e suite Signed-off-by: jannfis <jann@mistrust.net> * Exclude test suite from spellcheck Signed-off-by: jannfis <jann@mistrust.net>
1 parent 62a43ea commit 7ed1f67

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1482
-0
lines changed

.github/actions/spelling/excludes.txt

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ ignore$
1515
\.yaml$
1616
Dockerfile
1717
Makefile
18+
^test\/e2e\/.*

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ test-results
1313
.scannerwork
1414
.scratch
1515
*.goe
16+
**/kuttl-test.json
17+
**/kubeconfig

test/e2e/Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
IMAGE_REPO ?= 10.42.0.1:30000
2+
IMAGE_NAME ?= git-http
3+
IMAGE_TAG ?= latest
4+
5+
IMAGE_SLUG := $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
6+
7+
git-container-build: copy-testdata
8+
docker build -t $(IMAGE_SLUG) -f ./containers/git/Dockerfile ./containers/git
9+
10+
git-container-push: git-container-build
11+
docker push $(IMAGE_SLUG)
12+
13+
copy-testdata:
14+
cp -r testdata containers/git
15+
16+
install-prereqs:
17+
kustomize build prereqs/argocd | kubectl -n argocd-image-updater-e2e apply -f -
18+
kubectl apply -n argocd-image-updater-e2e -f prereqs/registry/registry.yaml
19+
kubectl rollout -n argocd-image-updater-e2e status deployment e2e-registry-public
20+
sleep 5
21+
make git-container-push
22+
kubectl apply -n argocd-image-updater-e2e -f prereqs/repo/install.yaml
23+
24+
.PHONY: git-container-build
25+
.PHONY: git-container-push
26+
.PHONY: copy-testdata

test/e2e/README.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# End-to-end tests
2+
3+
This directory contains the end-to-end tests for Argo CD Image Updater. The
4+
tests are implemented using [kuttl](https://kuttl.dev) and require some
5+
prerequisites.
6+
7+
**This is work-in-progress at a very early stage**. The end-to-end tests are
8+
not yet expected to work flawlessly, and they require an opinionated setup to
9+
run. If you are going to use the end-to-end tests, it is expected that you are
10+
prepared to hack on them. Do not ask for support, please.
11+
12+
# Components
13+
14+
The end-to-end tests are comprised of the following components:
15+
16+
* A local, vanilla K8s cluster that is treated as volatile. The tests only
17+
support k3s as a cluster at the moment.
18+
* A dedicated Argo CD installation. No other Argo CD must be installed to
19+
the test cluster.
20+
* A Git repository, containing resources to be consumed by Argo CD.
21+
This will be deployed on demand to the test cluster, with test data that
22+
is provided by the end-to-end tests.
23+
* A Docker registry, holding the container images we use for testing.
24+
This will be deployed on demand to the test cluster.
25+
26+
## Local cluster
27+
28+
### Cluster installation
29+
30+
1. Install a recent version of [k3s](https://k3s.io/) on your local machine.
31+
If you want to re-use your k3s cluster, be aware that the test suite needs
32+
changes to the cluster's configuration, i.e. it will set up a custom
33+
container registry and credentials.
34+
35+
2. Run `./bin/install.sh`. This will
36+
37+
* Configure your Docker daemon to be able to push to the test registry in
38+
an insecure manner.
39+
40+
* Configure K3s to be able to access the test registry
41+
42+
3. Create required namespace in the cluster: `kubectl create ns argocd-image-updater-e2e`
43+
44+
## Pre-requisites
45+
46+
1. Run `make install-prereqs` to install all the pre-requisites on your local
47+
cluster.

test/e2e/assets/Procfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fcgiwrap: sudo sh -c "(rm -f /var/run/fcgiwrap.socket && fcgiwrap -s unix:/var/run/fcgiwrap.socket & sleep 1 && chmod 777 /var/run/fcgiwrap.socket && wait)"
2+
nginx: sudo sh -c "nginx -g 'daemon off;' -c /etc/nginx/nginx.conf"

test/e2e/assets/daemon.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"insecure-registries" : ["10.42.0.1:30000"]
3+
}

test/e2e/assets/entrypoint.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if test "$(id -u)" == "0" -a "${USER_ID}" != ""; then
5+
useradd -u ${USER_ID} -d /home/user -s /bin/bash ${USER_NAME:-default}
6+
chown -R "${USER_NAME:-default}" ${GOCACHE}
7+
fi
8+
9+
export PATH=$PATH:/usr/local/go/bin:/go/bin
10+
export GOROOT=/usr/local/go
11+
12+
"$@"

test/e2e/assets/nginx.conf

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
error_log /dev/stdout info;
2+
worker_processes 1;
3+
4+
events { worker_connections 1024; }
5+
6+
http {
7+
8+
server {
9+
listen 0.0.0.0:8080;
10+
11+
root /tmp/testdata.git;
12+
13+
location ~ /argocd-image-updater-e2e(/.*) {
14+
# Set chunks to unlimited, as the body's can be huge
15+
client_max_body_size 0;
16+
17+
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
18+
include /etc/nginx/fastcgi_params;
19+
fastcgi_param GIT_HTTP_EXPORT_ALL "";
20+
fastcgi_param GIT_PROJECT_ROOT /tmp;
21+
fastcgi_param PATH_INFO $1;
22+
23+
# Hard-coded credentials for Git in this case
24+
fastcgi_param REMOTE_USER "admin";
25+
fastcgi_pass unix:/var/run/fcgiwrap.socket;
26+
}
27+
}
28+
29+
}

test/e2e/assets/registries.conf

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
registries:
2+
- name: Test Registry
3+
api_url: https://10.42.0.1:30000
4+
ping: yes
5+
prefix: 10.42.0.1:30000
6+
insecure: true

test/e2e/assets/registries.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
configs:
2+
"10.42.0.1:30000":
3+
tls:
4+
ca_file: /etc/rancher/k3s/local.crt
5+
insecure_skip_verify: true

test/e2e/assets/registry.crt

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
-----BEGIN CERTIFICATE-----
2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zvYiHSt
18+
jaSbtwsfQw67kfP6J1zcGq8cQXlt6oYyMc+NN2igcM1Uh11IsKBZ51ECAwEAAaNk
19+
MGIwHQYDVR0OBBYEFEcXCENhsmkLVlKECNTIXtP9t8SNMB8GA1UdIwQYMBaAFEcX
20+
CENhsmkLVlKECNTIXtP9t8SNMA8GA1UdEwEB/wQFMAMBAf8wDwYDVR0RBAgwBocE
21+
CioAATANBgkqhkiG9w0BAQsFAAOCAgEAjQAo4H2yc1+zyGTqNLb9b0VWvSKnM4si
22+
DGgu4LzU891/sQF6b42qoRQOnCUsySC57a4TYLat4ESOjhTijuZjWSyRkYiBag0O
23+
WuDXKBdhyEdRzoz9Alh0oiL/u8pHvk5ffWfSi5oF19dFwpYmjTX1gMhSZUb2ql8j
24+
l9buedFCsNt85C00a9lprztk9Tza73pXkCfXd7wCmVnBQeiwYp1OcFGm3p6eBUJC
25+
Zh9/3WtmsnOOXdC+/mMIh+DVOwyPLzPnG5Xtef40tXXiy+9l1ewCeeP+RnJH5sDM
26+
Xho9a7uvnNiyi0IfFlBsDC+Wsvq+k+fBLLQMq8oQjZ901Ty0fzp1+1pkCfvB4BOO
27+
74Bc6ekax9jYVWzMZ47WXJTvf+T8bVPyelBcNmVjDDFcALqI/gbhRXurjmLd+5S7
28+
3NkDTAU+6dj16R0V26pjq1YzXx6vVRAau+mYZqYCGsKzivLML3eEUK4WsLSRKtV0
29+
405MArAnVvk+bCgHp41UdYdqC3PkL2JFxNzUgtp0MMe5fRY7hVq0xJI01zwu7i9C
30+
cEBejFQpCVxQe5LnSJOSrFRYrZRzTEzGXsg6yKaxuiAFS3m6oIkiH+DSfI9HeiZV
31+
1n7q0zPYxjfR01C1C3VwAd/4z5esQJ+z42VffDE8fBzK5XdSAGy65VQdtKtPt0jE
32+
E4GvTlf+S3U=
33+
-----END CERTIFICATE-----

test/e2e/assets/registry.key

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
-----BEGIN PRIVATE KEY-----
2+
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tJNs37Pg14RLqu6yeZlT3o9TBLMpeJA1dqQ10BwuNUzFPypNoZ7UoG+Igf2zm
50+
ow6GSYMmnNmuDBf+ZZdpMHIvsmUVorNp8zK12JwDdGbo1zJM+Yv7nUaC+uOtmVj3
51+
6s67HUzoeh083rX2A1SDRB95PGzWMu0=
52+
-----END PRIVATE KEY-----

test/e2e/bin/install.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
set -e
3+
set -o pipefail
4+
set -x
5+
6+
BASE_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/.."
7+
8+
sudo mkdir -p /etc/rancher/k3s
9+
sudo mkdir -p /etc/docker
10+
11+
sudo cp ${BASE_DIR}/assets/registries.yaml /etc/rancher/k3s/registry.yaml
12+
sudo cp ${BASE_DIR}/assets/registry.crt /etc/rancher/k3s/local.crt
13+
sudo cp ${BASE_DIR}/assets/daemon.json /etc/docker/daemon.json
14+
15+
sudo systemctl restart k3s docker

test/e2e/containers/git/Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM nginx:alpine
2+
3+
RUN set -x && \
4+
apk --update upgrade && \
5+
apk add git git-daemon bash fcgiwrap spawn-fcgi wget && \
6+
adduser git -h /var/lib/git -D && \
7+
adduser nginx git && \
8+
git config --system http.receivepack true && \
9+
git config --system http.uploadpack true && \
10+
git config --system user.email "gitserver@git.com" && \
11+
git config --system user.name "Git Server" && \
12+
ln -sf /dev/stdout /var/log/nginx/access.log && \
13+
ln -sf /dev/stderr /var/log/nginx/error.log
14+
15+
16+
ADD ./etc /etc
17+
ADD ./entrypoint.sh /usr/local/bin/entrypoint
18+
19+
ENTRYPOINT [ "entrypoint" ]
20+
CMD [ "-start" ]
21+
22+
ADD ./testdata /var/lib/initial/testdata

test/e2e/containers/git/LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 anyakichi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

test/e2e/containers/git/README.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# gitserver-http [![Build Status](https://travis-ci.org/cirocosta/gitserver-http.svg?branch=master)](https://travis-ci.org/cirocosta/gitserver-http)
2+
3+
> A git server with Nginx as the HTTP frontend and fast cgi wrapper for running the git http backend
4+
5+
6+
## Usage
7+
8+
To run a git server without any repositories configured in advance but allowing them to be saved into `./repositories`:
9+
10+
```sh
11+
docker run \
12+
-d \ # deamonize
13+
-v `pwd`/repositories:/var/lib/git \ # mount the volume
14+
-p "8080:80" \ # expose the port
15+
cirocosta/gitserver-http
16+
```
17+
18+
Now, initialize a bare repository:
19+
20+
```sh
21+
cd repositories
22+
git init --bare myrepo.git
23+
```
24+
25+
and then, just clone it somewhere else:
26+
27+
```sh
28+
cd /tmp
29+
git clone http://localhost:8080/myrepo.git
30+
cd myrepo
31+
```
32+
33+
34+
### Pre-Initialization
35+
36+
Git servers work with bare repositories. This image provides the utility of initializing some pre-configured repositories in advance. Just add them to `/var/lib/initial` and then run the container. For instance, having the tree:
37+
38+
```
39+
.
40+
└── initial
41+
└── initial
42+
└── repo1
43+
└── file.txt
44+
```
45+
46+
and then executing
47+
48+
```sh
49+
docker run \
50+
-d \ # deamonize
51+
-v `pwd`/initial:/var/lib/initial \ # mount the initial volume
52+
-p "8080:80" \ # expose the port
53+
cirocosta/gitserver-http # start git server and init repositories
54+
```
55+
56+
will allow you to skip the `git init --bare` step and start with the repositories pre-"installed" there:
57+
58+
```sh
59+
git clone http://localhost/repo1.git
60+
cd repo1 && ls
61+
# file.txt
62+
```
63+
64+
65+
## Example
66+
67+
to run the example:
68+
69+
```sh
70+
make example
71+
```
72+
73+
74+
This will create a git server http service on `:80`. Now you can clone the sample repository:
75+
76+
77+
```sh
78+
git clone http://localhost:8080/repo1.git
79+
```
80+
81+

0 commit comments

Comments
 (0)