Skip to content

Commit f025fe7

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

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/integration/checkout_int_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,34 @@ 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 and use a different runtime path.
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+
// Normally, usr/bin/gperf is linked to the depot. Make sure it was copied.
421+
info, err := os.Stat(filepath.Join(targetDir, "usr", "bin", "gperf"))
422+
suite.Require().NoError(err)
423+
suite.Assert().True(info.Mode()&os.ModeSymlink == 0, "runtime should not have symlinks to the depot")
424+
}
425+
398426
func TestCheckoutIntegrationTestSuite(t *testing.T) {
399427
suite.Run(t, new(CheckoutIntegrationTestSuite))
400428
}

0 commit comments

Comments
 (0)