Skip to content

Commit

Permalink
fix gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
mycrEEpy committed Dec 26, 2024
1 parent 9eab85d commit 4d64dbc
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ go.work.sum

# Goreleaser
dist/
pakku
./pakku
60 changes: 60 additions & 0 deletions internal/pakku/pakku_integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package pakku

import (
"context"
"testing"

"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
)

var (
ctx = context.Background()

pakkuFile = testcontainers.ContainerFile{
HostFilePath: "pakku",
ContainerFilePath: "/usr/local/bin/pakku",
FileMode: 0o755,
}
)

func TestApt(t *testing.T) {
req := testcontainers.ContainerRequest{
Image: "public.ecr.aws/docker/library/debian:12",
Entrypoint: []string{"sleep", "60"},
Files: []testcontainers.ContainerFile{pakkuFile},
WaitingFor: wait.ForExit(),
}

container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,
Started: true,
})
defer testcontainers.CleanupContainer(t, container)
require.NoError(t, err)

rc, _, err := container.Exec(ctx, []string{"pakku", "init"})
require.NoError(t, err)
require.Zero(t, rc)

rc, _, err = container.Exec(ctx, []string{"pakku", "config"})
require.NoError(t, err)
require.Zero(t, rc)

rc, _, err = container.Exec(ctx, []string{"pakku", "add", "apt", "vim"})
require.NoError(t, err)
require.Zero(t, rc)

rc, _, err = container.Exec(ctx, []string{"pakku", "apply"})
require.NoError(t, err)
require.Zero(t, rc)

rc, _, err = container.Exec(ctx, []string{"pakku", "update"})
require.NoError(t, err)
require.Zero(t, rc)

rc, _, err = container.Exec(ctx, []string{"pakku", "remove", "apt", "vim"})
require.NoError(t, err)
require.Zero(t, rc)
}

0 comments on commit 4d64dbc

Please sign in to comment.