-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (73 loc) · 2.91 KB
/
test.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Go
on:
push:
branches:
- master
pull_request:
branches:
- "**"
workflow_call:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.0
- name: Test
run: make test
- name: Build
run: make bin
scenario-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.0
- name: Build
run: make bin
- name: Running Server
run: |
nohup bin/go-simple-auth-proxy start --config deployment/ci.toml > server.log &
sleep 5s
- name: Scenario 1 (No cookie or basicauth) - 401
run: |
curl -I -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' http://localhost:8080 > output.log
grep 'HTTP/1.1 401 Unauthorized' output.log
curl -I -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' http://localhost:8080 > output.log
grep 'HTTP/1.1 401 Unauthorized' output.log
- name: Scenario 2 (no cookie, basicauth) - 200
run: |
curl -I -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -u user:pass http://localhost:8080 > output.log
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -u user:pass http://localhost:8080 >> output.log
grep 'HTTP/1.1 200 OK' output.log
grep '<title>Welcome to nginx!</title>' output.log
- name: Scenario 3 (save cookie, no cookie, basicauth) - 200
run: |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -I -u user:pass -c cookie.txt http://localhost:8080 > output.log
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -u user:pass http://localhost:8080 >> output.log
grep 'HTTP/1.1 200 OK' output.log
grep '<title>Welcome to nginx!</title>' output.log
- name: Scenario 4 (No cookie or basicauth) - 401
run: |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -I http://localhost:8080 > output.log
grep 'HTTP/1.1 401 Unauthorized' output.log
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -I http://localhost:8080 > output.log
grep 'HTTP/1.1 401 Unauthorized' output.log
- name: Scenario 5 (use cookie, no basicauth) - 200
run: |
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -I -b cookie.txt http://localhost:8080 > output.log
curl -H 'X-Request-ID: bdedbd7f90385bf9966288a5f18a9d6a' -b cookie.txt http://localhost:8080 >> output.log
grep 'HTTP/1.1 200 OK' output.log
grep '<title>Welcome to nginx!</title>' output.log
- name: Show Server log
run: cat server.log
services:
nginx-app:
image: nginx:latest
ports:
- 8888:80