client: drop client timeout in tests
A timeout doesn't make sense on this level, because it is very difficult to estimate how long downloading rpm metadata takes. Drop it completely in favor of higher-level timeouts in the test runner. Fixes #601
This commit is contained in:
parent
d49f0fef44
commit
2ecdee6814
3 changed files with 3 additions and 8 deletions
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/test"
|
"github.com/osbuild/osbuild-composer/internal/test"
|
||||||
)
|
)
|
||||||
|
|
@ -21,7 +20,7 @@ var testState *TestState
|
||||||
// Also makes sure there is a running server to test against
|
// Also makes sure there is a running server to test against
|
||||||
func executeTests(m *testing.M) int {
|
func executeTests(m *testing.M) int {
|
||||||
var err error
|
var err error
|
||||||
testState, err = setUpTestState("/run/weldr/api.socket", 60*time.Second, false)
|
testState, err = setUpTestState("/run/weldr/api.socket", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("ERROR: Test setup failed: %s\n", err)
|
fmt.Printf("ERROR: Test setup failed: %s\n", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/distro/fedoratest"
|
"github.com/osbuild/osbuild-composer/internal/distro/fedoratest"
|
||||||
rpmmd_mock "github.com/osbuild/osbuild-composer/internal/mocks/rpmmd"
|
rpmmd_mock "github.com/osbuild/osbuild-composer/internal/mocks/rpmmd"
|
||||||
|
|
@ -58,7 +57,7 @@ func executeTests(m *testing.M) int {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
testState, err = setUpTestState(socketPath, 60*time.Second, true)
|
testState, err = setUpTestState(socketPath, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("ERROR: Test setup failed: %s\n", err)
|
log.Fatalf("ERROR: Test setup failed: %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestState struct {
|
type TestState struct {
|
||||||
|
|
@ -32,12 +31,10 @@ func isStringInSlice(slice []string, s string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func setUpTestState(socketPath string, timeout time.Duration, unitTest bool) (*TestState, error) {
|
func setUpTestState(socketPath string, unitTest bool) (*TestState, error) {
|
||||||
state := TestState{unitTest: unitTest}
|
state := TestState{unitTest: unitTest}
|
||||||
|
|
||||||
state.socket = &http.Client{
|
state.socket = &http.Client{
|
||||||
// TODO This may be too short/simple for downloading images
|
|
||||||
Timeout: timeout,
|
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
|
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
|
||||||
return net.Dial("unix", socketPath)
|
return net.Dial("unix", socketPath)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue