Skip to content

Commit 5973bcb

Browse files
committed
delete major
1 parent 746ece1 commit 5973bcb

File tree

1 file changed

+44
-28
lines changed

1 file changed

+44
-28
lines changed

internal/testtools/deb_test.go

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import (
1212
"strconv"
1313
"strings"
1414
"testing"
15-
16-
"github.com/stretchr/testify/require"
1715
)
1816

1917
var arch = flag.String("arch", "amd64", "target architecture")
@@ -27,19 +25,19 @@ func TestStableToUnstable(t *testing.T) {
2725

2826
fmt.Printf("Updating from stable version %s to unstable version %s \n", tagAppCli, majorTag)
2927
fmt.Printf("Building local deb version %s \n", majorTag)
30-
buildDebVersion(t, majorTag, *arch)
31-
fmt.Printf("Check folder structure and deb downloaded\n")
32-
ls(t)
33-
fmt.Println("**** BUILD docker image *****")
34-
buildDockerImage(t, "test.Dockerfile", "apt-test-update-image", *arch)
35-
fmt.Println("**** RUN docker image *****")
36-
runDockerCommand(t, "apt-test-update-image")
37-
preUpdateVersion := runDockerSystemVersion(t, "apt-test-update")
38-
runDockerSystemUpdate(t, "apt-test-update")
39-
postUpdateVersion := runDockerSystemVersion(t, "apt-test-update")
40-
runDockerCleanUp(t, "apt-test-update")
41-
require.Equal(t, preUpdateVersion, "Arduino App CLI "+tagAppCli+"\n")
42-
require.Equal(t, postUpdateVersion, "Arduino App CLI "+majorTag+"\n")
28+
// buildDebVersion(t, majorTag, *arch)
29+
// fmt.Printf("Check folder structure and deb downloaded\n")
30+
// ls(t)
31+
// fmt.Println("**** BUILD docker image *****")
32+
// buildDockerImage(t, "test.Dockerfile", "apt-test-update-image", *arch)
33+
// fmt.Println("**** RUN docker image *****")
34+
// runDockerCommand(t, "apt-test-update-image")
35+
// preUpdateVersion := runDockerSystemVersion(t, "apt-test-update")
36+
// runDockerSystemUpdate(t, "apt-test-update")
37+
// postUpdateVersion := runDockerSystemVersion(t, "apt-test-update")
38+
// runDockerCleanUp(t, "apt-test-update")
39+
// require.Equal(t, preUpdateVersion, "Arduino App CLI "+tagAppCli+"\n")
40+
// require.Equal(t, postUpdateVersion, "Arduino App CLI "+majorTag+"\n")
4341

4442
}
4543

@@ -52,18 +50,21 @@ func TestUnstableToStable(t *testing.T) {
5250
fmt.Printf("Updating from unstable version %s to stable version %s \n", minorTag, tagAppCli)
5351
fmt.Printf("Building local deb version %s \n", minorTag)
5452
buildDebVersion(t, minorTag, *arch)
55-
moveDeb(t, "build/", "build/stable", "arduino-app-cli", tagAppCli, *arch)
56-
57-
fmt.Println("**** BUILD docker image *****")
58-
buildDockerImage(t, "test.Dockerfile", "test-apt-update-unstable", *arch)
59-
fmt.Println("**** RUN docker image *****")
60-
runDockerCommand(t, "test-apt-update-unstable")
61-
preUpdateVersion := runDockerSystemVersion(t, "apt-test-update")
62-
runDockerSystemUpdate(t, "apt-test-update")
63-
postUpdateVersion := runDockerSystemVersion(t, "apt-test-update")
64-
runDockerCleanUp(t, "apt-test-update")
65-
require.Equal(t, preUpdateVersion, "Arduino App CLI "+tagAppCli+"\n")
66-
require.Equal(t, postUpdateVersion, "Arduino App CLI "+minorTag+"\n")
53+
moveDeb(t, "build/", "build/stable", "arduino-app-cli", minorTag, *arch)
54+
55+
fmt.Printf("Check folder structure and deb downloaded\n")
56+
ls(t)
57+
58+
// fmt.Println("**** BUILD docker image *****")
59+
// buildDockerImage(t, "test.Dockerfile", "test-apt-update-unstable-image", *arch)
60+
// fmt.Println("**** RUN docker image *****")
61+
// runDockerCommand(t, "test-apt-update-unstable-image")
62+
// preUpdateVersion := runDockerSystemVersion(t, "apt-test-update-unstable")
63+
// runDockerSystemUpdate(t, "apt-test-update-unstable")
64+
// postUpdateVersion := runDockerSystemVersion(t, "apt-test-update-unstable")
65+
// runDockerCleanUp(t, "apt-test-update-unstable")
66+
// require.Equal(t, preUpdateVersion, "Arduino App CLI "+tagAppCli+"\n")
67+
// require.Equal(t, postUpdateVersion, "Arduino App CLI "+minorTag+"\n")
6768

6869
}
6970

@@ -204,7 +205,7 @@ func runDockerCommand(t *testing.T, containerImageName string) {
204205
"-v", "/sys/fs/cgroup:/sys/fs/cgroup:rw",
205206
"-v", "/var/run/docker.sock:/var/run/docker.sock",
206207
"-e", "DOCKER_HOST=unix:///var/run/docker.sock",
207-
"--name", "apt-test-update",
208+
"--name", "apt-test-update-unstable",
208209
containerImageName,
209210
)
210211

@@ -277,6 +278,8 @@ func moveDeb(t *testing.T, startDir, targetDir, repo string, tagVersion string,
277278
if err := moveCmd.Run(); err != nil {
278279
panic(fmt.Errorf("failed to move deb file: %w", err))
279280
}
281+
282+
rm(t, debFile)
280283
}
281284

282285
func ls(t *testing.T) {
@@ -300,3 +303,16 @@ func ls(t *testing.T) {
300303
})
301304

302305
}
306+
307+
func rm(t *testing.T, pathFile string) {
308+
t.Helper()
309+
removeCmd := exec.Command("rm", pathFile)
310+
311+
err := removeCmd.Run()
312+
if err != nil {
313+
log.Fatalf("Failed to remove file: %v", err)
314+
}
315+
316+
fmt.Printf("📦 Removed %s\n", pathFile)
317+
318+
}

0 commit comments

Comments
 (0)