-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from bmf-san/feature/improve-test-cases
Improve test cases
- Loading branch information
Showing
7 changed files
with
254 additions
and
54 deletions.
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,44 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestParseFlags(t *testing.T) { | ||
os.Args = []string{"config", "../testdata/config/config.yml"} | ||
flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) | ||
|
||
err := parseFlags() | ||
if err != nil { | ||
t.Errorf("unexpected error: %v", err) | ||
} | ||
} | ||
|
||
func TestParseFlagsError(t *testing.T) { | ||
os.Args = []string{"invalid"} | ||
flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) | ||
|
||
err := parseFlags() | ||
if err == nil { | ||
t.Error("expected error") | ||
} | ||
} | ||
|
||
func TestSetConfig(t *testing.T) { | ||
_, err := setConfig("") | ||
if err == nil { | ||
t.Errorf("unexpected error: %v", err) | ||
} | ||
|
||
_, err = setConfig("invalid_file") | ||
if err == nil { | ||
t.Errorf("unexpected error: %v", err) | ||
} | ||
|
||
_, err = setConfig("../testdata/config/config.yml") | ||
if err != nil { | ||
t.Errorf("unexpected error: %v", err) | ||
} | ||
} |
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
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,18 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIC+jCCAeKgAwIBAgIRAMIgKU8yn8Rc3SqzTl+7UBIwDQYJKoZIhvcNAQELBQAw | ||
EjEQMA4GA1UEChMHQWNtZSBDbzAeFw0yNDA2MjUxMTQ4MTVaFw0yNTA2MjUxMTQ4 | ||
MTVaMBIxEDAOBgNVBAoTB0FjbWUgQ28wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw | ||
ggEKAoIBAQC/qVxv4cynNrnWPvLbbiDrwivDNjca8LBlUSeruYqJH6l2bqyFz3U4 | ||
lKnN3d6U+4VYXBu/beYjnTOk+K28tbEy27sFMnFNiWp0XyImvUOZ9hWo3mZVuwwf | ||
LyBJxYAdj1EL/KIl/j54N6/ZBuCbvpa076tXQdKrPy8PHFoGRJw0feZC5xh3cSCQ | ||
2sWIBt0noK7RppuAnklwLpK2IxpmgqEP0VbjqqZ0LU8qvctw8gRwiYhTcfqllazp | ||
tVN9DK+CozBLIPw9jyKkHBwYLORHa4M9x++TlFy98nNOM8eBS4VPbbPjtlqeJrd3 | ||
J7r5FwmF5zzcItpPJfBA7ui3Mp0uZAorAgMBAAGjSzBJMA4GA1UdDwEB/wQEAwIF | ||
oDATBgNVHSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBQGA1UdEQQNMAuC | ||
CWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOCAQEAqm+Fk8hEqvvTfGtQWg+WYGaG | ||
AjJM2/lmtij1n6Z4eEjNuRqutSzUfV0YOg4g+hXAfCyy7egSnuwPOZSHwM2A/St1 | ||
+Gh93djv+egbVDjcLwF8syeZIqqqBVdqwDrUaHQv+LPTgFZBO4qS6Rhe3EqT6S+L | ||
ClcSAOnRocQdg+JzniV2tsHhhIReUU0HF6n8tO6OuqJxOnObtYPUjtVPpu+KMMEp | ||
ugDnG1y/f75iNXF17wxEtT6qZc1hgLIn/jd6qPMxMYlVGr3/l6238r9KaxqPBXiZ | ||
tN4XcCOk1yANAUyBCeq3zmduyih0gFRpXG8A6TxPKxKqiLF+YV0KI0XQGLHmNA== | ||
-----END CERTIFICATE----- |
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,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC/qVxv4cynNrnW | ||
PvLbbiDrwivDNjca8LBlUSeruYqJH6l2bqyFz3U4lKnN3d6U+4VYXBu/beYjnTOk | ||
+K28tbEy27sFMnFNiWp0XyImvUOZ9hWo3mZVuwwfLyBJxYAdj1EL/KIl/j54N6/Z | ||
BuCbvpa076tXQdKrPy8PHFoGRJw0feZC5xh3cSCQ2sWIBt0noK7RppuAnklwLpK2 | ||
IxpmgqEP0VbjqqZ0LU8qvctw8gRwiYhTcfqllazptVN9DK+CozBLIPw9jyKkHBwY | ||
LORHa4M9x++TlFy98nNOM8eBS4VPbbPjtlqeJrd3J7r5FwmF5zzcItpPJfBA7ui3 | ||
Mp0uZAorAgMBAAECggEASbSkwrXwEQH/t3+fv3j7mg6i68CGsoqLG3t5KRYCS7ds | ||
YQowuIjOiILLRksjlOGhJxjM5vIphdqniLLFhYPN8EQGCPqcDfhhgv0u0f0I6UV0 | ||
kOtuKVv0Tm2+GgCkwzlhLp3p8Xhzp6Gqs2hsqhhCNrTQjI7YqFh1DXeWu0BZXem9 | ||
rmesH9ahUjc62X8DhjJgMvrwooSXKF7Iiub2OBiIgTZCFfZV9MqawZbskFg0DfKn | ||
c2kj/CdDWUaLV8sm+BG/DkDnhH+9BgPSgmjHakL0+burODKNdhiroekhx1pg1NlE | ||
O8t2ADxF6pSE92GnYcimwgFs076xfbml5dwtk8u0uQKBgQDzJDp5niD+BIMJzaYz | ||
LmJRM7ElyWue16dTfnUMDY8vERVxtrLExRmroMgFgMXGl7D/fKeFk61HFxQZ1Yn4 | ||
tYCDNnS2XiG2x+BDJHBXJudpFzf/eULaWrwc9PmxuWoujUdxTMN31DCGnohS99fB | ||
P/1jlfNeY2DACR82NFIzn7U2BwKBgQDJzCvbv4klwnI7zpeqrrgJ4o0YX54TR5Vo | ||
TDaaNK5T0dR5MFYX6eIQhvJO1A8lekWpsqzDSj/B6mEQZBxEiX/Zikwk/SAbbOYV | ||
Cqi8WVLBJ1FJa1OyWELYDd7iRF6EsDsICoOU9HU9UjQq8vMDC47kjXBKbosGJCzo | ||
E6vaVinhvQKBgBdLhkq2qsSLnB5pVJ4cuJC9GiDbrnL2iHKIcCBqgChrQ5m0fmY5 | ||
2B7IdcGJN+myCORBhi9XGcfw3x0mh2SLxzdLFV2PoT1I4ySrrhO7h3pbHiNc89nF | ||
zbYchnvPnuu833Zse2HUs52CPN9uHX7HabiL2lhVvyRG+3WPB70odQ0rAoGBAJ0M | ||
ZOW0fswANF8PPUH8kAZBZoWdhKyEfWaaSbRhY3qgRre6QoaB4wnxvApVRyRnsGeN | ||
Qp8J3ezQt5HGF6nPSMzIsNHonWA6tCWUEhXjfmAMdVqqSIz3263BvcBibRze+lIb | ||
vKPkTInYu/jg8vdfu2lsGgQTW+b/qGNFS+20OQwRAoGBAIe7MdYzlJf6dJ30fgl2 | ||
lcyhpYZfTV1LkLMn4SMUGUPhFSRzj7N/tYRER9GWVRh+QGxvwWJwJWXE+wZw+V1q | ||
7sTXHvPrgs+EHqYKLUfwbNWLftMsQ4lYnWyJBflQh65xxwPIlibTtGvU/fRiBnS7 | ||
MsUunajRiMaeNiRMiYqoDO7A | ||
-----END PRIVATE KEY----- |
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,15 @@ | ||
proxy: | ||
port: 443 | ||
read_header_timeout: 2000 | ||
shutdown_timeout: 3000 | ||
tls_cert_path: ../testdata/certificates/cert.pem | ||
tls_key_path: ../testdata/certificates/key.pem | ||
static_files: | ||
- path: /public/ | ||
dir: ./public | ||
upstreams: | ||
- host_name: backend1.local | ||
target: http://backend1:8081 # backend1 is the name of the container | ||
- host_name: backend2.local | ||
target: http://backend2:8082 # backend2 is the name of the container | ||
log_level: 0 # Debug:-4 Info:0 Warn:4 Error:8 |