Skip to content

Commit d1ec924

Browse files
authored
Merge branch 'main' into tenants
2 parents 6a148f6 + 65f45f8 commit d1ec924

File tree

9 files changed

+18
-46
lines changed

9 files changed

+18
-46
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Check nix-shell default.nix
6363
run: |
6464
set -o pipefail
65-
nix-shell --pure -E 'with import <nixpkgs> {}; mkShell { buildInputs = [ (import ./default.nix {}) ]; }' --run defang 2>&1 | sed -u 's|\s\+got:|::error file=pkgs/defang/cli.nix,line=9::Replace the vendorHash in cli.nix with the correct value:|'
65+
make test-nix 2>&1 | sed -u 's|\s\+got:|::error file=pkgs/defang/cli.nix,line=9::Replace the vendorHash in cli.nix with the correct value:|'
6666
6767
# go-byoc-test:
6868
# runs-on: ubuntu-latest
@@ -321,7 +321,7 @@ jobs:
321321
push-docker:
322322
runs-on: ubuntu-latest
323323
needs:
324-
- go-release
324+
- go-release
325325
steps:
326326
- uses: actions/checkout@v4
327327

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ pre-commit:
1010
@if git diff --cached --name-only | grep -q '^src/'; then make -C src lint; fi
1111

1212
.PHONY: pre-push
13-
pre-push: src/README.md
13+
pre-push: src/README.md test-nix
1414
@make -C src test
1515

16+
.PHONY: setup
1617
setup:
1718
go -C src mod tidy
1819

@@ -24,3 +25,7 @@ src/README.md: README.md
2425
@awk '/^## Environment Variables/{p=1} (/^## /||/^### /){if(p&&!/^## Environment Variables/){exit}} p' $< >> $@
2526
@echo 'src/README.md was updated because root README.md changed. Please add src/README.md to your commit.';
2627
@false
28+
29+
.PHONY: test-nix
30+
test-nix:
31+
nix-shell --pure -E 'with import <nixpkgs> {}; mkShell { buildInputs = [ (import ./default.nix {}) ]; }' --run defang

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
gnumake
2424
less
2525
gnused # force Linux `sed` everywhere
26-
go_1_23
26+
go_1_24
2727
golangci-lint
2828
goreleaser
2929
nixfmt-rfc-style

src/cmd/cli/command/commands_test.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,9 @@ func TestVersion(t *testing.T) {
137137
func TestCommandGates(t *testing.T) {
138138
mockService := &mockFabricService{}
139139
_, handler := defangv1connect.NewFabricControllerHandler(mockService)
140-
origDir, err := os.Getwd()
141-
if err != nil {
142-
t.Fatalf("Failed to get current directory: %v", err)
143-
}
144-
composeDir := "../../../../src/testdata/sanity"
145-
if err = os.Chdir(composeDir); err != nil {
146-
t.Fatalf("Failed to change directory: %v", err)
147-
}
140+
t.Chdir("../../../../src/testdata/sanity")
148141

149142
t.Setenv("AWS_REGION", "us-west-2")
150-
t.Cleanup(func() {
151-
os.Chdir(origDir)
152-
})
153143

154144
server := httptest.NewServer(handler)
155145
t.Cleanup(server.Close)

src/cmd/cli/command/configrandom_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestCreateRandomConfigValue(t *testing.T) {
1818
// create the scanner based on scanner config
1919
scannerClient, err := scanner.NewScannerFromConfig(cfg)
2020
if err != nil {
21-
t.Fatalf("Failed to make a config detector: " + err.Error())
21+
t.Fatalf("Failed to make a config detector: %v", err)
2222
}
2323

2424
// a map for storing generated results to check if they are unique
@@ -35,7 +35,7 @@ func TestCreateRandomConfigValue(t *testing.T) {
3535
// scan the config
3636
ds, err := scannerClient.Scan(randomConfig)
3737
if err != nil {
38-
t.Fatalf("Failed to scan input: " + err.Error())
38+
t.Fatalf("Failed to scan input: %v", err)
3939
}
4040

4141
// the length of ds (detected secrets) should be one

src/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/DefangLabs/defang/src
22

3-
go 1.23.0
3+
go 1.24
44

5-
toolchain go1.23.9
5+
toolchain go1.24.5
66

77
replace github.com/spf13/cobra v1.8.0 => github.com/DefangLabs/cobra v1.8.0-defang
88

src/pkg/cli/compose/compose_test.go

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,7 @@ func TestLoadProject(t *testing.T) {
146146
})
147147

148148
t.Run("load starting from a sub directory", func(t *testing.T) {
149-
cwd, _ := os.Getwd()
150-
151-
// setup
152-
setup := func() {
153-
os.MkdirAll("../../../testdata/alttestproj/subdir/subdir2", 0755)
154-
os.Chdir("../../../testdata/alttestproj/subdir/subdir2")
155-
}
156-
157-
//teardown
158-
teardown := func() {
159-
os.Chdir(cwd)
160-
os.RemoveAll("../../../testdata/alttestproj/subdir")
161-
}
162-
163-
setup()
164-
t.Cleanup(teardown)
149+
t.Chdir("../../../testdata/alttestproj/subdir/subdir2")
165150

166151
// execute test
167152
loader := NewLoader()
@@ -213,11 +198,7 @@ func TestComposeGoNoDoubleWarningLog(t *testing.T) {
213198
}
214199

215200
func TestComposeOnlyOneFile(t *testing.T) {
216-
cwd, _ := os.Getwd()
217-
t.Cleanup(func() {
218-
os.Chdir(cwd)
219-
})
220-
os.Chdir("../../../testdata/toomany")
201+
t.Chdir("../../../testdata/toomany")
221202

222203
loader := NewLoader()
223204
project, err := loader.LoadProject(context.Background())
@@ -231,11 +212,7 @@ func TestComposeOnlyOneFile(t *testing.T) {
231212
}
232213

233214
func TestComposeMultipleFiles(t *testing.T) {
234-
cwd, _ := os.Getwd()
235-
t.Cleanup(func() {
236-
os.Chdir(cwd)
237-
})
238-
os.Chdir("../../../testdata/multiple")
215+
t.Chdir("../../../testdata/multiple")
239216

240217
loader := NewLoader(WithPath("compose1.yaml", "compose2.yaml"))
241218
project, err := loader.LoadProject(context.Background())

src/pkg/cli/compose/context_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func TestWalkContextFolder(t *testing.T) {
166166
t.Fatalf("WalkContextFolder() failed: %v", err)
167167
}
168168

169-
expected := []string{"Dockerfile", "altcomp.yaml", "compose.yaml.fixup", "compose.yaml.golden", "compose.yaml.warnings"}
169+
expected := []string{"Dockerfile", "altcomp.yaml", "compose.yaml.fixup", "compose.yaml.golden", "compose.yaml.warnings", "subdir", "subdir/subdir2", "subdir/subdir2/.gitkeep"}
170170
if !reflect.DeepEqual(files, expected) {
171171
t.Errorf("Expected files: %v, got %v", expected, files)
172172
}

src/testdata/alttestproj/subdir/subdir2/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)