@@ -10,6 +10,7 @@ import (
1010
1111 "github.com/databricks/cli/libs/apps/manifest"
1212 "github.com/databricks/cli/libs/apps/prompt"
13+ "github.com/databricks/cli/libs/env"
1314 "github.com/spf13/cobra"
1415 "github.com/stretchr/testify/assert"
1516 "github.com/stretchr/testify/require"
@@ -642,8 +643,7 @@ func TestRunManifestOnlyFound(t *testing.T) {
642643 var buf bytes.Buffer
643644 _ , _ = io .Copy (& buf , r )
644645 out := buf .String ()
645- assert .Contains (t , out , `"version": "1.0"` )
646- assert .Contains (t , out , `"analytics"` )
646+ assert .Equal (t , content , out )
647647}
648648
649649func TestRunManifestOnlyNotFound (t * testing.T ) {
@@ -664,3 +664,26 @@ func TestRunManifestOnlyNotFound(t *testing.T) {
664664 out := buf .String ()
665665 assert .Equal (t , "No appkit.plugins.json manifest found in this template.\n " , out )
666666}
667+
668+ func TestRunManifestOnlyUsesTemplatePathEnvVar (t * testing.T ) {
669+ dir := t .TempDir ()
670+ manifestPath := filepath .Join (dir , manifest .ManifestFileName )
671+ content := `{"version":"1.0","scaffolding":{"command":"databricks apps init"}}`
672+ require .NoError (t , os .WriteFile (manifestPath , []byte (content ), 0o644 ))
673+
674+ old := os .Stdout
675+ r , w , err := os .Pipe ()
676+ require .NoError (t , err )
677+ os .Stdout = w
678+
679+ ctx := env .Set (t .Context (), templatePathEnvVar , dir )
680+ err = runManifestOnly (ctx , "" , "" , "" )
681+ w .Close ()
682+ os .Stdout = old
683+ require .NoError (t , err )
684+
685+ var buf bytes.Buffer
686+ _ , _ = io .Copy (& buf , r )
687+ out := buf .String ()
688+ assert .Equal (t , content , out )
689+ }
0 commit comments