Skip to content

Module Test Server Specs

In order to test a module, there needs to be an instance setup to serve content based on the specifications described here.

The Documents

The test harness expects the following file requests to return a normal 200 response under a base path. These files are either statically or dynamically generated. For static requests, a default docroot that is mapped into place (typically with Docker's -v option), can be used within the test harness. The important bit of these files is the sigsci_success string. The correct content type should be delivered in the response header.

The testing suite will request these files in all the base paths that will need to be handled.

html_content.html

Content-Type: text/html

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="description" content="HTML Content">
  <meta name="author" content="SigSci">
  <title>HTML Content</title>
</head>
<body>
  <p>sigsci_success</p>
</body>
</html>

text_content.txt

Content-Type: text/html

or

Content-Type: text/plain

sigsci_success

Handled Paths

/dynamic

The file requests under the dynamic base path should return a normal 200 response code with a response body containing sigsci_success.

Files requested by the test harness, which should be handled: * html_content.html: Should generate content similar to the same document described above. * text_content.txt: Should generate content similar to the same document described above. * missing_file.html: Should generate a 404 Not Found page (e.g., not handled).

/dynamic/custom_404

For some servers, a custom 404 (or other error page) takes a diffreent path in the server, such as creating a sub-request. If this is the case, then any request under the custom 404 path should generate a custom 404 response for the special file request of missing_file.html under this dynamic custom 404 base path.

/dynamic/upload

This is a special handled path with should echo the contents of a file uploaded in the file parameter as the response body.

NOTE: If the file upload is encoded (e.g., compressed with gzip), then it should be decoded before/while echoing the content back.

/dynamic/form

This is a special handled path that should echo the contents of the request body back as the response body. This is designed to be used for POST and PUT methods.

/dynamic/response

This is a special handled path where various parameter control the response that is generated.

Parameters that control response generation: * response_time: Sleep for the given milliseconds before generating a response. * size: Generate a response with the given size in bytes (e.g., repeat an 'a' this many times). * response_code: Response with the given status code. For 3xx codes, also generate a location header in the response (e.g., Location: /)

/static

The static base path is to simulate serving static content for servers that may server static content differently than dynamic content, the special static base path should serve the documents described above. Any content under this base path that is not found should serve the default 404 page.

NOTE: For pure dynamic servers that do not treat static content differently, this can be served excatly the same way as the dynamic base path.

/static/custom_404

For some servers, a custom 404 (or other error page) takes a diffreent path in the server, such as creating a sub-request. If this is the case, then any request under the custom 404 path should generate a customer 404 for any content under this base that is not found in the docroot.

/response

This is just the old alias which should be treated the same as /dynamic/response.