Включил интеграционный тест

master
Andrey Ivanov 2020-11-06 19:25:43 +03:00 committed by Andrey Ivanov
parent 5f909b50f8
commit c98a644ccd
4 changed files with 5 additions and 3 deletions

View File

@ -31,5 +31,6 @@ jobs:
script:
- make lint
- make unit-test
- make integration-test
- make build
if: (type = push) OR (type = pull_request)

View File

@ -41,7 +41,7 @@ func TestIntegrationPositive(t *testing.T) {
})
t.Run("remote server return jpeg", func(t *testing.T) {
defer wg.Done()
body, resp, err := request("http://localhost:80/fill/1024/504/localhost:"+testPort+"/gopher_original_1024x504.jpg", 15*time.Second)
body, resp, err := request("http://localhost:8080/fill/1024/504/localhost:"+testPort+"/gopher_original_1024x504.jpg", 15*time.Second)
require.NoError(t, err)
require.NotNil(t, body)
require.Equal(t, 200, resp.StatusCode)

View File

@ -1,6 +1,7 @@
package application
import (
"context"
"errors"
"fmt"
"io/ioutil"
@ -44,7 +45,7 @@ func (q Query) id() string {
func (q Query) fromOrigin(headers http.Header, timeout time.Duration) ([]byte, *http.Response, error) {
client := &http.Client{Timeout: timeout}
req, err := http.NewRequest("GET", "http://"+q.URL.Host+q.URL.Path, nil)
req, err := http.NewRequestWithContext(context.Background(), "GET", "http://"+q.URL.Host+q.URL.Path, nil)
if err != nil {
return nil, nil, fmt.Errorf("can't create request: %w", err)
}

View File

@ -1,6 +1,6 @@
[Server]
Address = "localhost"
Port = "80"
Port = "8080"
[Cache]
Capacity = 20