@@ -63,6 +63,28 @@ func TestManagedDeploy(t *testing.T) {
6363
6464 // verify changes are pushed to Github repo
6565 verifyGithubRepoContents (t , ghClient , resp .Project .GitRemote , changes )
66+
67+ // clone the project to an empty directory and remove the __rill_remote to simulate fresh deploys in CI/CD
68+
69+ cloneDir := t .TempDir ()
70+ cmd := exec .CommandContext (t .Context (), "git" , "clone" , resp .Project .GitRemote , cloneDir )
71+ out , err := cmd .CombinedOutput ()
72+ require .NoError (t , err , "git clone failed: %s" , out )
73+
74+ // remove __rill_remote to simulate fresh deploys in CI/CD where the git history is not preserved
75+ err = os .Remove (filepath .Join (cloneDir , ".git" , "refs" , "heads" , "main" ))
76+ require .NoError (t , err )
77+
78+ // deploy again from the cloned directory with changes
79+ changes2 := map [string ]string {
80+ "models/model.sql" : `SELECT 2 AS two` ,
81+ }
82+ putFiles (t , cloneDir , changes2 )
83+ result = u1 .Run (t , "deploy" , "--interactive=false" , "--org=github-test" , "--project=rill-mgd-deploy" , "--skip-deploy=true" , "--path=" + cloneDir )
84+ require .Equal (t , 0 , result .ExitCode , result .Output )
85+
86+ // verify changes are pushed to Github repo
87+ verifyGithubRepoContents (t , ghClient , resp .Project .GitRemote , changes2 )
6688}
6789
6890func TestManagedDeployWithPrimaryBranch (t * testing.T ) {
0 commit comments