e2e: run the clients against a real cloud
Every gate in this repo compares a client to the document, and every build proves the client is well-formed. Neither answers the question a user actually has: does it work against a server. Seven languages now answer it -- go, python, typescript, dart, php, ruby, rust -- against the local cloud by default and against anything HANZO_BASE_URL names. Each probe asserts a 200 whose body decodes AND a 403 that arrives as an error, because a client that swallows a refusal and returns a zero value looks exactly like one that works. It earned its place on the first run: GET /v1/models is AiAPI.GetModels in Go and ai_api::get_models in Rust but ModelsApi.getModels in TypeScript. One document, three groupings, and nothing but a call finds it.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import ai.hanzo.cloud.*;
|
||||
import ai.hanzo.cloud.api.*;
|
||||
|
||||
public class E2E {
|
||||
public static void main(String[] a) throws Exception {
|
||||
int fail = 0;
|
||||
ApiClient c = new ApiClient();
|
||||
c.setBasePath(System.getenv("HANZO_BASE_URL"));
|
||||
try {
|
||||
ApiResponse<?> r = new ModelsApi(c).getModelsWithHttpInfo();
|
||||
System.out.println(" ok GET /v1/models " + r.getStatusCode());
|
||||
} catch (ApiException e) {
|
||||
System.out.println(" FAIL models: " + e.getCode()); fail++;
|
||||
}
|
||||
try {
|
||||
new EngineApi(c).engineStatus();
|
||||
System.out.println(" FAIL engine: unauthenticated call reported success"); fail++;
|
||||
} catch (ApiException e) {
|
||||
System.out.println(" ok GET /v1/engine/status refused: " + e.getCode());
|
||||
}
|
||||
System.out.println(fail == 0 ? "PASS java" : "FAIL java (" + fail + ")");
|
||||
System.exit(fail == 0 ? 0 : 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user