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

This commit is contained in:
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: script:
- make lint - make lint
- make unit-test - make unit-test
- make integration-test
- make build - make build
if: (type = push) OR (type = pull_request) 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) { t.Run("remote server return jpeg", func(t *testing.T) {
defer wg.Done() 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.NoError(t, err)
require.NotNil(t, body) require.NotNil(t, body)
require.Equal(t, 200, resp.StatusCode) require.Equal(t, 200, resp.StatusCode)

View File

@ -1,6 +1,7 @@
package application package application
import ( import (
"context"
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "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) { func (q Query) fromOrigin(headers http.Header, timeout time.Duration) ([]byte, *http.Response, error) {
client := &http.Client{Timeout: timeout} 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 { if err != nil {
return nil, nil, fmt.Errorf("can't create request: %w", err) return nil, nil, fmt.Errorf("can't create request: %w", err)
} }

View File

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