All checks were successful
Check / check (push) Successful in 1m16s
Changes the Go module path from `git.eeqj.de/sneak/upaas` to `sneak.berlin/go/upaas`. All import paths in Go files updated accordingly. `go mod tidy` and `make check` pass cleanly. fixes #143 Co-authored-by: user <user@Mac.lan guest wan> Co-authored-by: Jeffrey Paul <sneak@noreply.example.org> Reviewed-on: #149 Co-authored-by: clawbot <clawbot@noreply.example.org> Co-committed-by: clawbot <clawbot@noreply.example.org>
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package deploy_test
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
"os"
|
|
"testing"
|
|
|
|
"sneak.berlin/go/upaas/internal/database"
|
|
"sneak.berlin/go/upaas/internal/docker"
|
|
"sneak.berlin/go/upaas/internal/models"
|
|
"sneak.berlin/go/upaas/internal/service/deploy"
|
|
)
|
|
|
|
func TestBuildContainerOptionsUsesImageID(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
db := database.NewTestDatabase(t)
|
|
|
|
app := models.NewApp(db)
|
|
app.Name = "myapp"
|
|
|
|
err := app.Save(context.Background())
|
|
if err != nil {
|
|
t.Fatalf("failed to save app: %v", err)
|
|
}
|
|
|
|
log := slog.New(slog.NewTextHandler(os.Stderr, nil))
|
|
svc := deploy.NewTestService(log)
|
|
|
|
const expectedImageID = docker.ImageID("sha256:abc123def456")
|
|
|
|
opts, err := svc.BuildContainerOptionsExported(context.Background(), app, expectedImageID)
|
|
if err != nil {
|
|
t.Fatalf("buildContainerOptions returned error: %v", err)
|
|
}
|
|
|
|
if opts.Image != expectedImageID.String() {
|
|
t.Errorf("expected Image=%q, got %q", expectedImageID, opts.Image)
|
|
}
|
|
|
|
if opts.Name != "upaas-myapp" {
|
|
t.Errorf("expected Name=%q, got %q", "upaas-myapp", opts.Name)
|
|
}
|
|
}
|