Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
ItamarYuran committed Jan 13, 2025
1 parent c5b6599 commit 99b25bc
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions esti/lakectl_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,32 +503,20 @@ func TestLakectlLocal_commitProtetedBranch(t *testing.T) {
"REF": mainBranch,
"LOCAL_DIR": dataDir,
}
runCmd(t, Lakectl()+" repo create lakefs://"+vars["REPO"]+" "+storage, false, false, vars)
runCmd(t, Lakectl()+" repo create lakefs://"+vars["REPO"]+" "+vars["STORAGE"], false, false, vars)

runCmd(t, Lakectl()+" branch-protect add lakefs://"+vars["REPO"]+"/ '*'", false, false, vars)

// Cloning local dir
RunCmdAndVerifyContainsText(t, Lakectl()+" local clone lakefs://"+vars["REPO"]+"/"+vars["BRANCH"]+"/ "+vars["LOCAL_DIR"], false, "Successfully cloned lakefs://${REPO}/${REF}/ to ${LOCAL_DIR}.", vars)
RunCmdAndVerifyContainsText(t, Lakectl()+" local status "+vars["LOCAL_DIR"], false, "No diff found", vars)

// Adding file to local dir
fd, err = os.Create(filepath.Join(dataDir, "test.txt"))
require.NoError(t, err)
require.NoError(t, fd.Close())
RunCmdAndVerifyContainsText(t, Lakectl()+" local status "+vars["LOCAL_DIR"], false, "local ║ added ║ test.txt", vars)

runCmdAndVerifyContainsText(t, Lakectl()+" branch-protect list lakefs://"+vars["REPO"]+"/ ", false, false, "*", vars)
str := runCmd(t, Lakectl()+" branch-protect list lakefs://"+vars["REPO"]+"/ ", false, false, vars)
fmt.Println("itamar testing", str)
// Commit changes to branch
//runCmd(t, Lakectl()+" commit lakefs://"+vars["REPO"]+"/"+vars["BRANCH"]+" --allow-empty-message -m \" \"", false, false, vars)

//RunCmdAndVerifyFailureContainsText(t, Lakectl()+" fs upload -s files/ro_1k lakefs://"+vars["REPO"]+"/"+vars["BRANCH"]+"/"+"fail_file.txt", false, "cannot write to protected branch", vars)
//RunCmdAndVerifyContainsText(t, Lakectl()+" local list", false, repoName+"/"+vars["BRANCH"], vars)

// Try to commit local dir, expect failure
RunCmdAndVerifyFailureContainsText(t, Lakectl()+" local commit -m test "+vars["LOCAL_DIR"], false, "cannot write to protected branch", vars)
//RunCmdAndVerifyFailureContainsText(t, Lakectl()+" fs rm "+dataDir, false, "cannot write to protected branch", vars)

//runCmd(t, Lakectl()+" branch-protect delete lakefs://"+repoName+"/ \"*\"", false, false, vars)

}

func TestLakectlLocal_commit(t *testing.T) {
Expand Down

0 comments on commit 99b25bc

Please sign in to comment.