test: moar integration tests [ci skip]

This commit is contained in:
2023-09-07 18:50:25 +02:00
parent 7a9224b2b2
commit 0be532692d
112 changed files with 3412 additions and 1142 deletions

View File

@ -20,12 +20,12 @@ var allFilterFlag = &cli.BoolFlag{
Destination: &allFilter,
}
var volunesFilter bool
var volumesFilter bool
var volumesFilterFlag = &cli.BoolFlag{
Name: "volumes, v",
Usage: "Prune volumes. This will remove app data, Be Careful!",
Destination: &volunesFilter,
Destination: &volumesFilter,
}
var serverPruneCommand = cli.Command{
@ -35,7 +35,7 @@ var serverPruneCommand = cli.Command{
Description: `
Prunes unused containers, networks, and dangling images.
If passing "-v/--volumes" then volumes not connected with a deployed app will
If passing "-v/--volumes" then volumes not connected to a deployed app will
also be removed. This can result in unwanted data loss if not used carefully.
`,
ArgsUsage: "[<server>]",
@ -44,12 +44,11 @@ also be removed. This can result in unwanted data loss if not used carefully.
volumesFilterFlag,
internal.DebugFlag,
internal.OfflineFlag,
internal.NoInputFlag,
},
Before: internal.SubCommandBefore,
BashComplete: autocomplete.ServerNameComplete,
Action: func(c *cli.Context) error {
var args filters.Args
serverName := internal.ValidateServer(c)
cl, err := client.New(serverName)
@ -57,6 +56,8 @@ also be removed. This can result in unwanted data loss if not used carefully.
logrus.Fatal(err)
}
var args filters.Args
ctx := context.Background()
cr, err := cl.ContainersPrune(ctx, args)
if err != nil {
@ -75,6 +76,7 @@ also be removed. This can result in unwanted data loss if not used carefully.
pruneFilters := filters.NewArgs()
if allFilter {
logrus.Debugf("removing all images, not only dangling ones")
pruneFilters.Add("dangling", "false")
}
@ -86,7 +88,7 @@ also be removed. This can result in unwanted data loss if not used carefully.
imgSpaceReclaimed := formatter.ByteCountSI(ir.SpaceReclaimed)
logrus.Infof("images pruned: %d; space reclaimed: %s", len(ir.ImagesDeleted), imgSpaceReclaimed)
if volunesFilter {
if volumesFilter {
vr, err := cl.VolumesPrune(ctx, args)
if err != nil {
logrus.Fatal(err)