mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore: cleanup compose-basic test
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/psviderski/uncloud/pkg/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func removeServices(t *testing.T, cli api.ServiceClient, names ...string) {
|
||||
ctx := context.Background()
|
||||
for _, name := range names {
|
||||
err := cli.RemoveService(ctx, name)
|
||||
if !errors.Is(err, api.ErrNotFound) {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func removeVolumes(t *testing.T, cli api.VolumeClient, names ...string) {
|
||||
ctx := context.Background()
|
||||
|
||||
volumes, err := cli.ListVolumes(ctx, &api.VolumeFilter{Names: names})
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, vol := range volumes {
|
||||
err = cli.RemoveVolume(ctx, vol.MachineID, vol.Volume.Name, false)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user