Skip to content

Commit

Permalink
Updated integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Aug 9, 2024
1 parent ed597ca commit 8e8d7ac
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions internal/integrationtest/upload_mock/upload_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,17 @@ func TestUploadSketch(t *testing.T) {
sketchPath := cli.SketchbookDir().Join(sketchName)
_, _, err := cli.Run("sketch", "new", sketchPath.String())
require.NoError(t, err)
buildDir := generateBuildDir(sketchPath, t)

out, _, err := cli.Run("config", "get", "build_cache.path")
require.NoError(t, err)
cacheDir := paths.New(strings.TrimSpace(string(out)))

md5 := md5.Sum(([]byte(sketchPath.String())))
sketchPathMd5 := strings.ToUpper(hex.EncodeToString(md5[:]))
buildDir := cacheDir.Join("sketches", sketchPathMd5)
require.NoError(t, buildDir.MkdirAll())
require.NoError(t, buildDir.ToAbs())

t.Cleanup(func() { buildDir.RemoveAll() })

for i, _test := range testParameters {
Expand Down Expand Up @@ -718,15 +728,6 @@ func TestUploadSketch(t *testing.T) {
}
}

func generateBuildDir(sketchPath *paths.Path, t *testing.T) *paths.Path {
md5 := md5.Sum(([]byte(sketchPath.String())))
sketchPathMd5 := strings.ToUpper(hex.EncodeToString(md5[:]))
buildDir := paths.TempDir().Join("arduino", "sketches", sketchPathMd5)
require.NoError(t, buildDir.MkdirAll())
require.NoError(t, buildDir.ToAbs())
return buildDir
}

func TestUploadWithInputDirFlag(t *testing.T) {
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
defer env.CleanUp()
Expand Down

0 comments on commit 8e8d7ac

Please sign in to comment.