-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply new Standard Ensembler routing policy with Custom Experiment En…
…gines (#237) * Add route_name_path to standard ensembler config * Update ensembler struct in test data to reflect latest schema * Add additional validation tests to ensure that experiment mappings and route name path are not both set * Add additional test case to verify the route name path is valid * Refactor request parsing test * Remove redundant regex route path name check * Update regex expression to allow empty route_name_path string * Remove required tag from EnsemblerStandardConfig.RouteNamePath * Add e2e tests for std ensemblers with route_name_path * Add additional conditional to e2e tests to check for ensembler pods only when docker/pyfunc types are used * Fix e2e test data * Add positive test to verify valid router config creation * Fix router api test data * Add additional unit tests for router service creation with std ensemblers with route name path * Replace deprecated ioutil functions with corresponding io or os ones * Fix lint comments on indenting conditional statements * Fix e2e tests after changes from rebasing * Fix bug in e2e test for std ensembler with route name path * Fix sdk e2e tests * Remove experiment mappings as a required field and update regex for route name path * Add custom validator for standard ensembler config * Remove standard ensembler config schema checks from request verification layer * Make standard ensembler only parse non nil configs to fiber config * Remove unnecessary route name path field in json request * Remove duplicated error messages from EnsemblerStandardConfig custom validation checks * Remove regex expression for route_name_path
- Loading branch information
1 parent
93a16cb
commit 9aedab8
Showing
32 changed files
with
604 additions
and
101 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
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
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
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
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
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
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
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
55 changes: 55 additions & 0 deletions
55
api/e2e/test/09_deploy_router_with_route_name_path_std_ensembler_test.go
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//go:build e2e | ||
|
||
package e2e | ||
|
||
import ( | ||
"net/http" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/caraml-dev/turing/api/turing/models" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
/* | ||
Steps: | ||
Create a new router with valid config for the router. | ||
a. Test GET router immediately > empty config | ||
b. Wait for success response from deployment | ||
c. Test GET router version > status shows "deployed" | ||
d. Test GET router > config section shows version 1, status "deployed" | ||
e. Test cluster that deployments exist | ||
f. Make a request to the router, validate the response. | ||
*/ | ||
func TestDeployRouterWithRouteNamePathInStandardEnsembler(t *testing.T) { | ||
// Create router | ||
t.Log("Creating router") | ||
data := makeRouterPayload( | ||
filepath.Join("testdata", "create_router_std_ensembler_route_name_path.json.tmpl"), | ||
globalTestContext) | ||
|
||
withDeployedRouter(t, data, | ||
func(router *models.Router) { | ||
t.Log("Testing router endpoint: POST " + router.Endpoint) | ||
withRouterResponse(t, | ||
http.MethodPost, | ||
router.Endpoint, | ||
http.Header{ | ||
"Content-Type": {"application/json"}, | ||
"X-Mirror-Body": {"true"}, | ||
}, | ||
`{"client": {"id": 4}}`, | ||
func(response *http.Response, responsePayload []byte) { | ||
assert.Equal(t, http.StatusOK, response.StatusCode, | ||
"Unexpected response (code %d): %s", | ||
response.StatusCode, string(responsePayload)) | ||
actualResponse := string(responsePayload) | ||
expectedResponse := `{ | ||
"version" : "treatment-a" | ||
}` | ||
assert.JSONEq(t, expectedResponse, actualResponse) | ||
}) | ||
}, | ||
nil, | ||
) | ||
} |
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
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
Oops, something went wrong.