generated from VLADIMIR/template
fix
This commit is contained in:
@@ -103,7 +103,7 @@ func TestGatewayDownloadTeamQR(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
data, err := io.ReadAll(resp.Body)
|
data, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -122,7 +122,7 @@ func TestGatewayDownloadTeamQR(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer resp2.Body.Close()
|
defer func() { _ = resp2.Body.Close() }()
|
||||||
if resp2.StatusCode != http.StatusNotFound {
|
if resp2.StatusCode != http.StatusNotFound {
|
||||||
t.Fatalf("missing game: %d", resp2.StatusCode)
|
t.Fatalf("missing game: %d", resp2.StatusCode)
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ func TestGatewayUploadRawZip(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("POST: %v", err)
|
t.Fatalf("POST: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
@@ -220,7 +220,7 @@ func TestGatewayDownloadZipWithContentDisposition(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("GET: %v", err)
|
t.Fatalf("GET: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
@@ -247,7 +247,7 @@ func TestGatewayDownloadFileNosniff(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("GET: %v", err)
|
t.Fatalf("GET: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
@@ -285,7 +285,7 @@ func TestGatewayUploadArchiveOverLimit(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("POST: %v", err)
|
t.Fatalf("POST: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusRequestEntityTooLarge {
|
if resp.StatusCode != http.StatusRequestEntityTooLarge {
|
||||||
@@ -309,7 +309,7 @@ func TestGatewayUploadFileOverHTTPLimit(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("POST: %v", err)
|
t.Fatalf("POST: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusRequestEntityTooLarge {
|
if resp.StatusCode != http.StatusRequestEntityTooLarge {
|
||||||
@@ -332,7 +332,7 @@ func TestGatewayUploadFileExactLimit(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("POST: %v", err)
|
t.Fatalf("POST: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
@@ -354,7 +354,7 @@ func TestGatewayUploadFileResourceExhausted(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("POST: %v", err)
|
t.Fatalf("POST: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusRequestEntityTooLarge {
|
if resp.StatusCode != http.StatusRequestEntityTooLarge {
|
||||||
|
|||||||
@@ -74,16 +74,22 @@ func TestChangeUserPasswordTransports(t *testing.T) {
|
|||||||
repo := &passwordRepo{role: "admin"}
|
repo := &passwordRepo{role: "admin"}
|
||||||
svc := users_service.NewUsersService(repo, nil, nil, nil, nil, "")
|
svc := users_service.NewUsersService(repo, nil, nil, nil, nil, "")
|
||||||
listener := bufconn.Listen(1024 * 1024)
|
listener := bufconn.Listen(1024 * 1024)
|
||||||
defer listener.Close()
|
defer func() { _ = listener.Close() }()
|
||||||
gs := grpc.NewServer(grpc.UnaryInterceptor(processor_jwt.NewAuthorizationInterceptor(nil, jwt)))
|
gs := grpc.NewServer(grpc.UnaryInterceptor(processor_jwt.NewAuthorizationInterceptor(nil, jwt)))
|
||||||
proto.RegisterEveningDetectiveServerServer(gs, &server{usersService: svc})
|
proto.RegisterEveningDetectiveServerServer(gs, &server{usersService: svc})
|
||||||
go gs.Serve(listener)
|
serveErr := make(chan error, 1)
|
||||||
defer gs.Stop()
|
go func() { serveErr <- gs.Serve(listener) }()
|
||||||
|
defer func() {
|
||||||
|
gs.Stop()
|
||||||
|
if err := <-serveErr; err != nil && !errors.Is(err, grpc.ErrServerStopped) {
|
||||||
|
t.Errorf("gRPC server: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
conn, err := grpc.NewClient("passthrough:///test", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return listener.Dial() }))
|
conn, err := grpc.NewClient("passthrough:///test", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return listener.Dial() }))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer func() { _ = conn.Close() }()
|
||||||
mux := runtime.NewServeMux()
|
mux := runtime.NewServeMux()
|
||||||
if err := proto.RegisterEveningDetectiveServerHandler(ctx, mux, conn); err != nil {
|
if err := proto.RegisterEveningDetectiveServerHandler(ctx, mux, conn); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func startSMTPTestServer(t *testing.T, hang bool, cert tls.Certificate) (addr st
|
|||||||
// handleSMTPConn обслуживает один SMTP-диалог, достаточный для net/smtp:
|
// handleSMTPConn обслуживает один SMTP-диалог, достаточный для net/smtp:
|
||||||
// EHLO, AUTH PLAIN, MAIL, RCPT, DATA, QUIT.
|
// EHLO, AUTH PLAIN, MAIL, RCPT, DATA, QUIT.
|
||||||
func handleSMTPConn(conn net.Conn, messages chan<- []byte) {
|
func handleSMTPConn(conn net.Conn, messages chan<- []byte) {
|
||||||
defer conn.Close()
|
defer func() { _ = conn.Close() }()
|
||||||
|
|
||||||
r := bufio.NewReader(conn)
|
r := bufio.NewReader(conn)
|
||||||
write := func(s string) { _, _ = conn.Write([]byte(s)) }
|
write := func(s string) { _, _ = conn.Write([]byte(s)) }
|
||||||
|
|||||||
@@ -929,7 +929,9 @@ func TestScenarioBackgroundLifecycle(t *testing.T) {
|
|||||||
if strings.Contains(repo.byID[id].Scenario, testDomain) {
|
if strings.Contains(repo.byID[id].Scenario, testDomain) {
|
||||||
t.Fatal("stored absolute URL")
|
t.Fatal("stored absolute URL")
|
||||||
}
|
}
|
||||||
storage.Put(ctx, &file_storage.File{Name: "room.png", Data: []byte("image")})
|
if err := storage.Put(ctx, &file_storage.File{Name: "room.png", Data: []byte("image")}); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
data, _, err := service.DownloadArchive(ctx, id, 7, false)
|
data, _, err := service.DownloadArchive(ctx, id, 7, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user