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:
Evgenii Orlov
2025-07-21 19:30:02 +02:00
committed by GitHub
co-authored by Pasha Sviderski Anton Ovchinnikov
parent 6fb07db4b2
commit da3634b690
56 changed files with 170 additions and 116 deletions
-1
View File
@@ -20,7 +20,6 @@ import (
"github.com/psviderski/uncloud/pkg/api"
"github.com/psviderski/uncloud/pkg/client/compose"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+6 -6
View File
@@ -259,8 +259,8 @@ func TestDeployment(t *testing.T) {
assert.Len(t, machines.ToSlice(), 3, "Expected 1 container on each machine")
// TODO: update the container spec in-place if only the placement constraint has changed.
//containers = serviceContainerIDs(svc)
//assert.True(t, initialContainers.IsSubset(containers), "Expected all initial containers to remain")
// containers = serviceContainerIDs(svc)
// assert.True(t, initialContainers.IsSubset(containers), "Expected all initial containers to remain")
})
t.Run("caddy", func(t *testing.T) {
@@ -334,7 +334,7 @@ func TestDeployment(t *testing.T) {
assertServiceMatchesSpec(t, svc, deployment.Spec)
assert.Equal(t, c.Machines[0].ID, svc.Containers[0].MachineID)
//initialContainerID := svc.Containers[0].Container.ID
// initialContainerID := svc.Containers[0].Container.ID
// Deploy to all machines without a placement constraint.
deployment, err = cli.NewCaddyDeployment(image, api.Placement{})
@@ -352,8 +352,8 @@ func TestDeployment(t *testing.T) {
machines := serviceMachines(svc)
assert.Len(t, machines.ToSlice(), 3, "Expected 1 container on each machine")
// TODO: update the container spec in-place if only the placement constraint has changed.
//containers := serviceContainerIDs(svc)
//assert.True(t, containers.Contains(initialContainerID), "Expected initial container to remain")
// containers := serviceContainerIDs(svc)
// assert.True(t, containers.Contains(initialContainerID), "Expected initial container to remain")
})
t.Run("replicated", func(t *testing.T) {
@@ -587,7 +587,7 @@ func TestDeployment(t *testing.T) {
require.Error(t, err, "Deployment should fail when volume doesn't exist")
require.Contains(t, err.Error(), "no machines available")
// TODO: implement and check for more details about the failed constraints.
//require.Contains(t, err.Error(), "volume 'non-existent-volume' not found")
// require.Contains(t, err.Error(), "volume 'non-existent-volume' not found")
})
// Tests that when a volume exists on a single machine, all requested replicas will be deployed to that machine,