Skip to content

Commit

Permalink
fix: correctly return unset for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 11, 2023
1 parent 53c3843 commit 5da7ba1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crdbx/staleness.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func ConsistencyLevelFromString(in string) ConsistencyLevel {
case string(ConsistencyLevelEventual):
return ConsistencyLevelEventual
case string(ConsistencyLevelUnset):
return ConsistencyLevelStrong
return ConsistencyLevelUnset
}
return ConsistencyLevelStrong
}
Expand Down
1 change: 1 addition & 0 deletions crdbx/staleness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func TestConsistencyLevelFromRequest(t *testing.T) {
assert.Equal(t, ConsistencyLevelStrong, ConsistencyLevelFromRequest(&http.Request{URL: urlx.ParseOrPanic("/?consistency=strong")}))
assert.Equal(t, ConsistencyLevelEventual, ConsistencyLevelFromRequest(&http.Request{URL: urlx.ParseOrPanic("/?consistency=eventual")}))
assert.Equal(t, ConsistencyLevelStrong, ConsistencyLevelFromRequest(&http.Request{URL: urlx.ParseOrPanic("/?consistency=asdf")}))
assert.Equal(t, ConsistencyLevelUnset, ConsistencyLevelFromRequest(&http.Request{URL: urlx.ParseOrPanic("/?consistency")}))

}

Expand Down

0 comments on commit 5da7ba1

Please sign in to comment.