Skip to content

Commit c442dda

Browse files
committed
test: fix windows CI tests.
Signed-off-by: i4k <t.nateldemoura@gmail.com>
1 parent cf8c727 commit c442dda

5 files changed

Lines changed: 21 additions & 24 deletions

File tree

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
# Copyright 2023 Terramate GmbH
22
# SPDX-License-Identifier: MPL-2.0
33

4-
name: ci-experimental
4+
name: ci-windows
55
on:
66
push:
7-
paths-ignore:
8-
- 'docs/**'
9-
- 'makefiles/**'
10-
- '.github/**'
11-
- '**/*.tm.hcl'
12-
- '.tool-versions'
137

148
jobs:
159
build_test:

e2etests/cloud/run_script_cloud_preview_test.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package cloud_test
55

66
import (
77
"encoding/json"
8-
"fmt"
98
"net/http"
109
"os"
1110
"path/filepath"
@@ -72,22 +71,20 @@ func TestScriptRunWithCloudSyncPreview(t *testing.T) {
7271
}
7372
}
7473
`,
75-
fmt.Sprintf(`f:stack/preview.tm:
74+
`f:stack/preview.tm:
7675
7776
script "preview" {
7877
description = "sync a preview"
7978
job {
8079
commands = [
81-
["%s", "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode", {
80+
["terraform", "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode", {
8281
sync_preview = true,
8382
terraform_plan_file = "out.tfplan",
8483
}],
8584
]
8685
}
8786
}
8887
`,
89-
TerraformTestPath,
90-
),
9188
`f:stack/main.tf:
9289
resource "local_file" "foo" {
9390
content = "test content"
@@ -129,22 +126,20 @@ func TestScriptRunWithCloudSyncPreview(t *testing.T) {
129126
}
130127
}
131128
`,
132-
fmt.Sprintf(`f:stack/preview.tm:
129+
`f:stack/preview.tm:
133130
134131
script "preview" {
135132
description = "sync a preview"
136133
job {
137134
commands = [
138-
["%s", "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode", {
135+
["terraform", "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode", {
139136
sync_preview = true,
140137
terraform_plan_file = "out.tfplan",
141138
}],
142139
]
143140
}
144141
}
145142
`,
146-
TerraformTestPath,
147-
),
148143
`f:stack/main.tf:
149144
resource "local_file" "foo" {
150145
content = "test content"
@@ -177,7 +172,7 @@ func TestScriptRunWithCloudSyncPreview(t *testing.T) {
177172
{
178173
ID: "1",
179174
Status: "changed",
180-
Cmd: []string{TerraformTestPath, "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode"},
175+
Cmd: []string{"terraform", "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode"},
181176
},
182177
},
183178
ReviewRequest: &cloud.ReviewRequest{
@@ -239,23 +234,21 @@ func TestScriptRunWithCloudSyncPreview(t *testing.T) {
239234
}
240235
}
241236
`,
242-
fmt.Sprintf(`f:stack/preview.tm:
237+
`f:stack/preview.tm:
243238
244239
script "preview" {
245240
description = "sync a preview"
246241
job {
247242
commands = [
248243
["do-not-exist-command"],
249-
["%s", "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode", {
244+
["terraform", "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode", {
250245
sync_preview = true,
251246
terraform_plan_file = "out.tfplan",
252247
}],
253248
]
254249
}
255250
}
256251
`,
257-
TerraformTestPath,
258-
),
259252
`f:stack/main.tf:
260253
resource "local_file" "foo" {
261254
content = "test content"
@@ -285,7 +278,7 @@ func TestScriptRunWithCloudSyncPreview(t *testing.T) {
285278
{
286279
ID: "1",
287280
Status: "failed",
288-
Cmd: []string{TerraformTestPath, "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode"},
281+
Cmd: []string{"terraform", "plan", "-out=out.tfplan", "-no-color", "-detailed-exitcode"},
289282
},
290283
},
291284
ReviewRequest: &cloud.ReviewRequest{

e2etests/core/run_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2613,8 +2613,8 @@ func TestRunOutput(t *testing.T) {
26132613
name: "run without eval",
26142614
runArgs: []string{HelperPath, "echo", "hello"},
26152615
want: RunExpected{
2616-
Stderr: "terramate: Entering stack in /stack" + "\n" +
2617-
fmt.Sprintf(`terramate: Executing command "%s echo hello"`, HelperPath) + "\n",
2616+
StderrRegex: "terramate: Entering stack in /stack" + "\n" +
2617+
`terramate: Executing command ".*? echo hello"` + "\n",
26182618
Stdout: "hello\n",
26192619
},
26202620
},

e2etests/internal/runner/setup.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ var TerraformVersion string
2323
// TerraformTestPath is the path to the installed terraform binary.
2424
var TerraformTestPath string
2525

26+
// TerraformTestPathAsHCL is the path to the installed terraform binary
27+
// but suited for including in an HCL string expression.
28+
var TerraformTestPathAsHCL string
29+
2630
var terraformCleanup func()
2731

2832
// HelperPath is the path to the test binary we compiled for test purposes
@@ -64,6 +68,10 @@ func Setup(projectRoot string) (err error) {
6468
err = errors.E(err, "failed to setup Terraform binary")
6569
return
6670
}
71+
TerraformTestPathAsHCL = fmt.Sprintf(`${tm_chomp(<<-EOF
72+
%s
73+
EOF
74+
)}`, TerraformTestPath)
6775
})
6876

6977
if err == nil {

makefiles/windows.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ tempdir=$(shell .\bin\helper.exe tempdir)
3434
test: test/helper build
3535
set TM_TEST_ROOT_TEMPDIR=$(tempdir)
3636
go test -timeout 30m -p 100 ./...
37+
set status=%errorlevel%
3738
.\bin\helper.exe rm $(tempdir)
3839
.\bin\terramate.exe run -- helper.exe true
40+
exit %status%
3941

4042
## remove build artifacts
4143
.PHONY: clean

0 commit comments

Comments
 (0)