Skip to content

Commit 0ba30b8

Browse files
committed
delete major
1 parent 746ece1 commit 0ba30b8

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

internal/testtools/deb_test.go

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,19 @@ func TestUnstableToStable(t *testing.T) {
5252
fmt.Printf("Updating from unstable version %s to stable version %s \n", minorTag, tagAppCli)
5353
fmt.Printf("Building local deb version %s \n", minorTag)
5454
buildDebVersion(t, minorTag, *arch)
55-
moveDeb(t, "build/", "build/stable", "arduino-app-cli", tagAppCli, *arch)
55+
moveDeb(t, "build/", "build/stable", "arduino-app-cli", minorTag, *arch)
56+
57+
fmt.Printf("Check folder structure and deb downloaded\n")
58+
ls(t)
5659

5760
fmt.Println("**** BUILD docker image *****")
58-
buildDockerImage(t, "test.Dockerfile", "test-apt-update-unstable", *arch)
61+
buildDockerImage(t, "test.Dockerfile", "test-apt-update-unstable-image", *arch)
5962
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")
63+
runDockerCommand(t, "test-apt-update-unstable-image")
64+
preUpdateVersion := runDockerSystemVersion(t, "apt-test-update-unstable")
65+
runDockerSystemUpdate(t, "apt-test-update-unstable")
66+
postUpdateVersion := runDockerSystemVersion(t, "apt-test-update-unstable")
67+
runDockerCleanUp(t, "apt-test-update-unstable")
6568
require.Equal(t, preUpdateVersion, "Arduino App CLI "+tagAppCli+"\n")
6669
require.Equal(t, postUpdateVersion, "Arduino App CLI "+minorTag+"\n")
6770

@@ -204,7 +207,7 @@ func runDockerCommand(t *testing.T, containerImageName string) {
204207
"-v", "/sys/fs/cgroup:/sys/fs/cgroup:rw",
205208
"-v", "/var/run/docker.sock:/var/run/docker.sock",
206209
"-e", "DOCKER_HOST=unix:///var/run/docker.sock",
207-
"--name", "apt-test-update",
210+
"--name", "apt-test-update-unstable",
208211
containerImageName,
209212
)
210213

@@ -277,6 +280,8 @@ func moveDeb(t *testing.T, startDir, targetDir, repo string, tagVersion string,
277280
if err := moveCmd.Run(); err != nil {
278281
panic(fmt.Errorf("failed to move deb file: %w", err))
279282
}
283+
284+
rm(t, debFile)
280285
}
281286

282287
func ls(t *testing.T) {
@@ -300,3 +305,16 @@ func ls(t *testing.T) {
300305
})
301306

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

0 commit comments

Comments
 (0)