Skip to content

Commit

Permalink
PMM-7 Fix starlark test. (#2377)
Browse files Browse the repository at this point in the history
  • Loading branch information
BupycHuk authored Jul 21, 2023
1 parent dd4f9cd commit e92400f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions managed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ release: ## Build pmm-managed release binaries
env CGO_ENABLED=0 go build -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/...
$(PMM_RELEASE_PATH)/pmm-managed --version

release-starlark:
env CGO_ENABLED=0 go build -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/pmm-managed-starlark/...
$(PMM_RELEASE_PATH)/pmm-managed-starlark --version

ARCH=$(shell uname -m)
release-dev: ## Build pmm-managed binaries for development
if [ $(ARCH) = "aarch64" ]; then \
Expand Down
9 changes: 8 additions & 1 deletion managed/cmd/pmm-managed-starlark/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ package main

import (
"bytes"
"context"
"encoding/json"
"os"
"os/exec"
"testing"
"time"

"github.com/percona-platform/saas/pkg/check"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -103,8 +105,13 @@ func TestStarlarkSandbox(t *testing.T) { //nolint:tparallel
},
}

ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
t.Cleanup(cancel)
// since we run the binary as a child process to test it we need to build it first.
err := exec.Command("make", "-C", "../..", "release").Run()
command := exec.CommandContext(ctx, "make", "-C", "../..", "release-starlark")
command.Stdout = os.Stdout
command.Stderr = os.Stderr
err := command.Run()
require.NoError(t, err)

for _, tc := range testCases {
Expand Down

0 comments on commit e92400f

Please sign in to comment.