-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LEAF-4487 - large query move test into form query and make test fail …
…when large query server/code is not in use
- Loading branch information
shane
committed
Dec 2, 2024
1 parent
5f9eab1
commit 094343d
Showing
2 changed files
with
43 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,15 +208,14 @@ func TestFormQuery_FindTwoSteps(t *testing.T) { | |
} | ||
} | ||
|
||
|
||
/* post a new employee to an orgchart format question and then confirm expected values on orgchart property */ | ||
func TestFormQuery_Employee_Format__Orgchart_Has_Expected_Values(t *testing.T) { | ||
mock_orgchart_employee := FormQuery_Orgchart_Employee{ | ||
FirstName: "Ramon", | ||
LastName: "Watsica", | ||
FirstName: "Ramon", | ||
LastName: "Watsica", | ||
MiddleName: "Yundt", | ||
Email: "[email protected]", | ||
UserName: "vtrycxbethany", | ||
Email: "[email protected]", | ||
UserName: "vtrycxbethany", | ||
} | ||
|
||
postData := url.Values{} | ||
|
@@ -243,7 +242,7 @@ func TestFormQuery_Employee_Format__Orgchart_Has_Expected_Values(t *testing.T) { | |
recData := formRes[11].S1 | ||
|
||
dataInterface := recData["id8_orgchart"] | ||
orgchart := dataInterface.(map[string]interface {}) | ||
orgchart := dataInterface.(map[string]interface{}) | ||
b, _ := json.Marshal(orgchart) | ||
|
||
var org_emp FormQuery_Orgchart_Employee | ||
|
@@ -278,3 +277,41 @@ func TestFormQuery_Employee_Format__Orgchart_Has_Expected_Values(t *testing.T) { | |
t.Errorf("userName got = %v, want = %v", got, want) | ||
} | ||
} | ||
|
||
func TestLargeFormQuery_SmallQuery(t *testing.T) { | ||
url := RootURL + `api/form/query/?q={"terms":[{"id":"stepID","operator":"!=","match":"resolved","gate":"AND"},{"id":"deleted","operator":"=","match":0,"gate":"AND"}],"joins":["status","initiatorName"],"sort":{},"limit":10000,"getData":["9","8","10","4","5","7","3","6","2"]}&x-filterData=recordID,title,stepTitle,lastStatus,lastName,firstName` | ||
|
||
url = strings.Replace(url, " ", "%20", -1) | ||
res, _ := client.Get(url) | ||
b, _ := io.ReadAll(res.Body) | ||
|
||
var formQueryResponse FormQueryResponse | ||
_ = json.Unmarshal(b, &formQueryResponse) | ||
|
||
if _, exists := formQueryResponse[958]; !exists { | ||
t.Errorf("Record 958 should be readable") | ||
} | ||
|
||
if v, ok := res.Header["Leaf_large_queries"]; ok && v[0] != "pass_onto_large_query_server" { | ||
t.Errorf("bad headers: %v", res.Header) | ||
} | ||
} | ||
|
||
func TestLargeFormQuery_LargeQuery(t *testing.T) { | ||
url := RootURL + `api/form/query/?q={"terms":[{"id":"stepID","operator":"!=","match":"resolved","gate":"AND"},{"id":"deleted","operator":"=","match":0,"gate":"AND"}],"joins":["status","initiatorName"],"sort":{},"getData":["9","8","10","4","5","7","3","6","2"]}&x-filterData=recordID,title,stepTitle,lastStatus,lastName,firstName` | ||
|
||
url = strings.Replace(url, " ", "%20", -1) | ||
res, _ := client.Get(url) | ||
b, _ := io.ReadAll(res.Body) | ||
|
||
var formQueryResponse FormQueryResponse | ||
_ = json.Unmarshal(b, &formQueryResponse) | ||
|
||
if _, exists := formQueryResponse[958]; !exists { | ||
t.Errorf("Record 958 should be readable") | ||
} | ||
|
||
if v, ok := res.Header["Leaf_large_queries"]; ok && v[0] != "process_ran_on_large_query_server" { | ||
t.Errorf("bad headers: %v", res.Header) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.