Skip to content

Commit

Permalink
yallla
Browse files Browse the repository at this point in the history
  • Loading branch information
ItamarYuran committed Jan 19, 2025
1 parent 1f52a58 commit 1b64392
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions esti/lakectl_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func TestLakectlLocal_commitProtectedBranch(t *testing.T) {
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)
// BranchUpdateMaxInterval - sleep in order to overcome branch update caching
time.Sleep(branchProtectTimeout * time.Second)
time.Sleep(branchProtectTimeout)
// 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)
Expand Down Expand Up @@ -554,8 +554,7 @@ func TestLakectlLocal_RmCommitProtectedBranch(t *testing.T) {
RunCmdAndVerifyContainsText(t, Lakectl()+" local commit "+vars["LOCAL_DIR"]+" -m test", false, "Commit for branch \""+vars["BRANCH"]+"\" completed.", vars)
runCmd(t, Lakectl()+" branch-protect add lakefs://"+vars["REPO"]+"/ '*'", false, false, vars)
// BranchUpdateMaxInterval - sleep in order to overcome branch update caching
time.Sleep(branchProtectTimeout * time.Second)

time.Sleep(branchProtectTimeout)
// Try delete file from local dir and then commit
require.NoError(t, os.Remove(filepath.Join(vars["LOCAL_DIR"], vars["FILE_PATH"])))
RunCmdAndVerifyContainsText(t, Lakectl()+" local status "+vars["LOCAL_DIR"], false, "local ║ removed ║ "+vars["FILE_PATH"], vars)
Expand Down
6 changes: 3 additions & 3 deletions esti/lakectl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var emptyVars = make(map[string]string)

const branchProtectTimeout = graveler.BranchUpdateMaxInterval + 1
const branchProtectTimeout = graveler.BranchUpdateMaxInterval + time.Second

func TestLakectlHelp(t *testing.T) {
RunCmdAndVerifySuccessWithFile(t, Lakectl(), false, "lakectl_help", emptyVars)
Expand Down Expand Up @@ -742,7 +742,7 @@ func TestLakectlFsUpload_protectedBranch(t *testing.T) {
runCmd(t, Lakectl()+" branch-protect add lakefs://"+vars["REPO"]+"/ '*'", false, false, vars)
RunCmdAndVerifyContainsText(t, Lakectl()+" branch-protect list lakefs://"+vars["REPO"]+"/ ", false, "*", vars)
// BranchUpdateMaxInterval - sleep in order to overcome branch update caching
time.Sleep(branchProtectTimeout * time.Second)
time.Sleep(branchProtectTimeout)
vars["FILE_PATH"] = "ro_1k.0"
RunCmdAndVerifyFailure(t, Lakectl()+" fs upload lakefs://"+vars["REPO"]+"/"+vars["BRANCH"]+"/"+vars["FILE_PATH"]+" -s files/ro_1k", false, "cannot write to protected branch\n403 Forbidden\n", vars)
}
Expand All @@ -762,7 +762,7 @@ func TestLakectlFsRm_protectedBranch(t *testing.T) {
runCmd(t, Lakectl()+" commit lakefs://"+vars["REPO"]+"/"+vars["BRANCH"]+" --allow-empty-message -m \" \"", false, false, vars)
runCmd(t, Lakectl()+" branch-protect add lakefs://"+vars["REPO"]+"/ '*'", false, false, vars)
// BranchUpdateMaxInterval - sleep in order to overcome branch update caching
time.Sleep(branchProtectTimeout * time.Second)
time.Sleep(branchProtectTimeout)
RunCmdAndVerifyContainsText(t, Lakectl()+" branch-protect list lakefs://"+vars["REPO"]+"/ ", false, "*", vars)
RunCmdAndVerifyFailure(t, Lakectl()+" fs rm lakefs://"+vars["REPO"]+"/"+vars["BRANCH"]+"/"+vars["FILE_PATH"], false, "cannot write to protected branch\n403 Forbidden\n", vars)
}
Expand Down

0 comments on commit 1b64392

Please sign in to comment.