Skip to content

Commit 67cc9d1

Browse files
committed
Added integration test for state checkout --portable.
1 parent 0847d46 commit 67cc9d1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/integration/checkout_int_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,39 @@ func (suite *CheckoutIntegrationTestSuite) TestCheckoutFromArchive() {
395395
cp.ExpectExitCode(0)
396396
}
397397

398+
func (suite *CheckoutIntegrationTestSuite) TestCheckoutPortable() {
399+
suite.OnlyRunForTags(tagsuite.Checkout)
400+
ts := e2e.New(suite.T(), false)
401+
defer ts.Close()
402+
403+
// Checkout a working runtime.
404+
cp := ts.Spawn("checkout", "ActiveState-CLI/small-python#fb513fe6-b9f4-4c54-adf3-8a7833b290f3", ".", "--portable")
405+
cp.Expect("Checked out project")
406+
cp.ExpectExitCode(0)
407+
408+
// Remove the artifact depot.
409+
suite.Require().NoError(os.RemoveAll(filepath.Join(ts.Dirs.Cache, "depot")))
410+
411+
// Verify the runtime still works because its contents are copies, not links.
412+
proj, err := project.FromPath(ts.Dirs.Work)
413+
suite.Require().NoError(err)
414+
targetDir := filepath.Join(ts.Dirs.Cache, runtime_helpers.DirNameFromProjectDir(proj.Dir()))
415+
pythonExe := filepath.Join(rt.ExecutorsPath(targetDir), "python3"+osutils.ExeExtension)
416+
cp = ts.SpawnCmd(pythonExe, "--version")
417+
cp.Expect("Python 3")
418+
cp.ExpectExitCode(0)
419+
420+
// Verify there are no symlinks in the runtime.
421+
files, err := fileutils.ListDir(targetDir, true)
422+
suite.Require().NoError(err)
423+
for _, file := range files {
424+
path := filepath.Join(targetDir, file.Name())
425+
resolvedPath, err := fileutils.ResolvePath(path)
426+
suite.Require().NoError(err)
427+
suite.Assert().NotContains(resolvedPath, "depot", "runtime file '%s' should not be linked to the depot", file.Name())
428+
}
429+
}
430+
398431
func TestCheckoutIntegrationTestSuite(t *testing.T) {
399432
suite.Run(t, new(CheckoutIntegrationTestSuite))
400433
}

0 commit comments

Comments
 (0)