Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
owenthereal committed Oct 2, 2023
1 parent 00c718d commit 4cef124
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ func Test_Server(t *testing.T) {
errch <- err
}()

http := &http.Client{
Timeout: 2 * time.Second,
client := &http.Client{
Timeout: time.Second,
}

t.Run("http addr", func(t *testing.T) {
waitUntil(t, 5*time.Second, 10, func() error {
resp, err := http.Get(fmt.Sprintf("http://%s/config/apps/http/servers/http/listen/0", adminAddr))
rr, err := client.Get(fmt.Sprintf("http://%s/config/", adminAddr))
fmt.Println(err)
if err == nil {
bb, err := io.ReadAll(rr.Body)
fmt.Println(string(bb))
fmt.Println(err)
}

resp, err := client.Get(fmt.Sprintf("http://%s/config/apps/http/servers/http/listen/0", adminAddr))
if err != nil {
return err
}
Expand All @@ -83,7 +91,7 @@ func Test_Server(t *testing.T) {

t.Run("https addr", func(t *testing.T) {
waitUntil(t, 5*time.Second, 10, func() error {
resp, err := http.Get(fmt.Sprintf("http://%s/config/apps/http/servers/https/listen/0", adminAddr))
resp, err := client.Get(fmt.Sprintf("http://%s/config/apps/http/servers/https/listen/0", adminAddr))
if err != nil {
return err
}
Expand All @@ -105,7 +113,7 @@ func Test_Server(t *testing.T) {

t.Run("tls subjects", func(t *testing.T) {
waitUntil(t, 5*time.Second, 10, func() error {
resp, err := http.Get(fmt.Sprintf("http://%s/config/apps/tls/automation/policies/0/subjects", adminAddr))
resp, err := client.Get(fmt.Sprintf("http://%s/config/apps/tls/automation/policies/0/subjects", adminAddr))
if err != nil {
return nil
}
Expand Down Expand Up @@ -166,7 +174,7 @@ func Test_Server(t *testing.T) {
t.Fatalf("Unexpected IPs (-want +got): %s", diff)
}

resp, err := http.Get(fmt.Sprintf("http://%s/config/apps/tls/automation/policies/0/subjects", adminAddr))
resp, err := client.Get(fmt.Sprintf("http://%s/config/apps/tls/automation/policies/0/subjects", adminAddr))
if err != nil {
return nil
}
Expand Down

0 comments on commit 4cef124

Please sign in to comment.