-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
71 lines (59 loc) · 2.65 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.PHONY: flake8
flake8:
python -m flake8 --exclude=.git *.py tcms_api tests
.PHONY: pylint
pylint:
PYTHONPATH=. python -m pylint --extension-pkg-whitelist=kerberos \
--load-plugins=pylint.extensions.no_self_use \
-d missing-docstring -d duplicate-code \
tcms_api/ tests/
.PHONY: test
test:
python -m coverage run --source tcms_api setup.py test
.PHONY: test-codecov
test-codecov: test
codecov
.PHONY: build
build:
./tests/check-build
.PHONY: build-services
build-services:
docker build -t kiwitcms/kerberos -f tests/krb5/Dockerfile.kerberos tests/krb5/
docker build -t kiwitcms/with-kerberos -f tests/krb5/Dockerfile.kiwitcms tests/krb5/
.PHONY: run-services
run-services:
docker compose -f tests/krb5/docker-compose.yml up -d
docker cp krb5_kiwitcms_org:/tmp/application.keytab .
docker cp ./application.keytab web_kiwitcms_org:/Kiwi/application.keytab
rm ./application.keytab
docker exec -u 0 -i web_kiwitcms_org /bin/bash -c 'chown 1001:root /Kiwi/application.keytab'
docker exec -i web_kiwitcms_org /Kiwi/manage.py migrate
docker exec -i web_kiwitcms_org /Kiwi/manage.py createsuperuser --noinput --username super-root --email [email protected]
cat tests/krb5/kiwitcms_kerberos/db_init.py | docker exec -i web_kiwitcms_org /Kiwi/manage.py shell
@echo "=== add the following to client's /etc/hosts & /etc/krb5.conf ==="
@echo "--- web.kiwitcms.org ---"
@docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' web_kiwitcms_org
@echo "--- krb5.kiwitcms.org ---"
@docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' krb5_kiwitcms_org
.PHONY: verify-integration
verify-integration:
PYTHONPATH=. python -m coverage run --source tcms_api ./tests/krb5/integration_test.py
.PHONY: verify-credentials-via-python
verify-credentials-via-python:
PYTHONPATH=. python -m coverage run --source tcms_api ./tests/krb5/python_credentials_test.py
.PHONY: verify-curl-with-kerberos
verify-curl-with-kerberos:
# make sure curl supports Negotiate authentication
curl -V | egrep -i "GSS-Negotiate|GSS-API|Kerberos"
.PHONY: verify-web-login
verify-web-login: verify-curl-with-kerberos
# grab the page
curl -k -L -o /tmp/curl.log --negotiate -u: \
-b /tmp/cookie.jar -c /tmp/cookie.jar \
https://web.kiwitcms.org:8443/login/kerberos/
# verify user has been logged in
cat /tmp/curl.log | grep 'Kiwi TCMS - Dashboard'
cat /tmp/curl.log | grep 'Test executions'
cat /tmp/curl.log | grep 'Your Test plans'
# verify username is 'travis', e.g. taken from '[email protected]' principal
cat /tmp/curl.log | grep '<a href="/accounts/travis/profile/" target="_parent">My profile</a>'