mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
E2E tests use repeated strings for test data where constants add no value (#97)
--------- Co-authored-by: Pasha Sviderski <me@psviderski.name> Co-authored-by: Anton Ovchinnikov <anton@tonyo.info>
This commit is contained in:
co-authored by
Pasha Sviderski
Anton Ovchinnikov
parent
6fb07db4b2
commit
da3634b690
@@ -1,10 +1,11 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"net/netip"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPortSpec_Validate(t *testing.T) {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/distribution/reference"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLatestCaddyImage(t *testing.T) {
|
||||
|
||||
@@ -128,7 +128,7 @@ func convertServicePortConfigToPortSpec(port types.ServicePortConfig) (api.PortS
|
||||
|
||||
// convertStandardPortsToPortSpecs converts []types.ServicePortConfig directly to api.PortSpecs.
|
||||
func convertStandardPortsToPortSpecs(ports []types.ServicePortConfig) ([]api.PortSpec, error) {
|
||||
var specs = make([]api.PortSpec, 0, len(ports))
|
||||
specs := make([]api.PortSpec, 0, len(ports))
|
||||
|
||||
for _, port := range ports {
|
||||
spec, err := convertServicePortConfigToPortSpec(port)
|
||||
|
||||
@@ -3,13 +3,14 @@ package connector
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/psviderski/uncloud/internal/machine"
|
||||
"github.com/psviderski/uncloud/internal/sshexec"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type SSHConnectorConfig struct {
|
||||
|
||||
@@ -3,9 +3,10 @@ package connector
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/netip"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"net/netip"
|
||||
)
|
||||
|
||||
// TCPConnector establishes a connection to the machine API through a direct TCP connection to an API endpoint.
|
||||
|
||||
@@ -3,6 +3,10 @@ package connector
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
"strconv"
|
||||
|
||||
"github.com/psviderski/uncloud/internal/cli/config"
|
||||
machine2 "github.com/psviderski/uncloud/internal/machine"
|
||||
"github.com/psviderski/uncloud/internal/machine/network"
|
||||
@@ -10,9 +14,6 @@ import (
|
||||
"github.com/psviderski/uncloud/pkg/client"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"net"
|
||||
"net/netip"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// WireGuardConnector establishes a connection to the cluster API through a WireGuard tunnel
|
||||
|
||||
@@ -11,9 +11,11 @@ import (
|
||||
|
||||
type ContainerSpecStatus string
|
||||
|
||||
const ContainerUpToDate ContainerSpecStatus = "up-to-date"
|
||||
const ContainerNeedsUpdate ContainerSpecStatus = "needs-update"
|
||||
const ContainerNeedsRecreate ContainerSpecStatus = "needs-recreate"
|
||||
const (
|
||||
ContainerUpToDate ContainerSpecStatus = "up-to-date"
|
||||
ContainerNeedsUpdate ContainerSpecStatus = "needs-update"
|
||||
ContainerNeedsRecreate ContainerSpecStatus = "needs-recreate"
|
||||
)
|
||||
|
||||
func EvalContainerSpecChange(current api.ServiceSpec, new api.ServiceSpec) ContainerSpecStatus {
|
||||
current = current.SetDefaults()
|
||||
|
||||
+5
-4
@@ -4,6 +4,11 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/cenkalti/backoff/v4"
|
||||
"github.com/docker/compose/v2/pkg/progress"
|
||||
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
||||
@@ -11,10 +16,6 @@ import (
|
||||
"github.com/psviderski/uncloud/pkg/api"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"io"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// GetDomain returns the cluster domain name or ErrNotFound if it hasn't been reserved yet.
|
||||
|
||||
+2
-1
@@ -2,10 +2,11 @@ package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/netip"
|
||||
|
||||
"github.com/psviderski/uncloud/internal/machine/network"
|
||||
"github.com/psviderski/uncloud/internal/secret"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
"net/netip"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
|
||||
Reference in New Issue
Block a user