Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Use release binary in integration tests #98

Merged
merged 1 commit into from
Aug 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ci/integration/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ func init() {

// build the coder-cli binary and move to the integration testing bin directory
func build(path string) error {
tar := fmt.Sprintf("coder-cli-linux-amd64.tar.gz")
dir := filepath.Dir(path)
cmd := exec.Command(
"sh", "-c",
fmt.Sprintf("cd ../../ && go build -o %s ./cmd/coder", path),
fmt.Sprintf(
"cd ../../ && mkdir -p %s && ./ci/steps/build.sh && cp ./ci/bin/%s %s/ && tar -xzf %s -C %s",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you just pulled the go build command into its own function and source it so you can call it? Would remove the step of tar -> untar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer it to use as close to the actual release artifact as possible. Maybe that's not particularly rational in this case but the aim of this test is to prevent the previous regression from going undetected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

dir, tar, dir, filepath.Join(dir, tar), dir),
)
cmd.Env = append(os.Environ(), "GOOS=linux", "CGO_ENABLED=0")

out, err := cmd.CombinedOutput()
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions ci/steps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ cd "$(dirname "$0")"
export GOARCH=amd64
tag=$(git describe --tags)

mkdir -p bin

build(){
tmpdir=$(mktemp -d)
go build -ldflags "-X main.version=${tag}" -o "$tmpdir/coder" ../../cmd/coder
Expand Down