An HTTP server with test methods for synthetic tests:
GET /is a hello-world.GET /before-server-shutdown?url=https://someurlreturns a 204 and will cause the provided URL to be called when a SIGTERM signal is captured and before stopping the server. Optionally, adelaycan be provided to override a wait time in seconds (default is 5s).GET /call-after-server-shutdown?url=https://someurlreturns a 204 and will cause the provided URL to be called after stopping the server. Optionally, adelaycan be provided to override a wait time in seconds (default is 5s).PUT /claim-memory?amount=<bytes_count>returns a 204 but before that creates abyte[]slice of the given length. If it goes oom, then it dies. ;-)GET /closewill cause the server to be shut down. Query parameters:delay(default0) can be set to a positive number. The code will then wait the amount in seconds before the server is shut down.force(defaultfalse) can be set totrue. The code then calls the forcefulClose()instead of the gracefulShutdown()function on the Go HTTP server.silent(defaultfalse) can be set totrue. The shutdown will then not be logged.terminate(defaulttrue) can be set tofalse. The code will then after shutting down the server not end the process but wait for another SIGINT or SIGTERM signal.
GET /compute-resource-tokenreturns details about the mounted compute resource token in the container, or a 404 if no one is present.PUT /compute-resource-token?action=login&iam=https://iam.cloud.ibm.com&profile-name=someTrustedProfileNametries to use the mounted compute resource token to create an IAM access token. Returns 204 if that succeeds, 404 is no compute resource token is mounted, 403 if no access token could be created. Query parameters:actionmust be set tologin.iam(defaulthttps://iam.cloud.ibm.com) allows to overwrite the IAM endpoint.profileNamespecifies the name of the trusted profile.
GET /env?env=someEnvKeyreturns the value of an environment variable in the response body.GET /filesystem?path=<path>, returns 200 with the file content if the path exists and is a file, 204 if it exists but is a directory, 404 if not found, and 500 for any other error.HEAD /filesystem?path=<path>, returns 200 if the path exists and is a file, 204 if it exists but is a directory, 404 if not found, and 500 for any other error.GET /flaky?code=503will return a 503 on every other call, with 200 on the respective next call. Thecodecan be omitted, it will default to502.GET /get-url?url=<target-url>, performs a GET request to the target URL and returns the response headers and body from the target.HEAD /get-url?url=<target-url>, performs a GET request to the target URL but only returns the status code from the response.GET /livecheckreturns 204 initially.PUT /livecheck?code=newCodechanges this.delayargument can be provided which overrides the default five seconds that it waits before it performs the call.GET /request-header?header=someHeaderKeyreturns the value of a request header in the response body. If the header is present multiple times, then the response contains all values concatenated by comma.GET /sleep?delay=5will return a 204 after five seconds.GET /write-regularly?interval=1&count=10will respond with 200 and write a 4 kB message into the response body every n seconds defined by the interval, n times defined by the count./wsendpoint serves a websocket with an echo service that return everything that is send to it.