- From: James Graham <james@hoppipolla.co.uk>
- Date: Wed, 07 Aug 2013 08:17:14 -0700
- To: <public-test-infra@w3.org>
On 2013-08-07 03:05, Robin Berjon wrote: > On 07/08/2013 03:11 , James Graham wrote: >> Another option is to build atop the mozbase http server [1]. This is >> already used internally for testing in Mozilla, so there is no >> problem >> deploying it in a large automated testing scenario. It is also >> relatively easy to customise, and doesn't require people running >> tests >> to have the ability to compile C code (or to ship binaries for lots >> of >> platforms). > > That actually looks like a very decent starting point. We can easily > add API endpoints with specific behaviour that we need. > > Do you know if API endpoints can be added and removed dynamically? I'm sure I can make it support that if it doesn't already :) > The sort of thing I have in mind would involve a way of doing the > following: > > POST /api/create-endpoint > > { > "method": "GET", > "actions": [ > 200, > "h Content-Type: text/javascript", > "wait 2000", > "b foo()" > ] > } > > and it would return > > 201 CREATED > > { "endpoint": "/api/Xh23jY" } > > which would be an endpoint, in existence for, say, an hour, that > would support the simple behaviour described. However, I'm not sure that I understand the value of that :) Why is it easier to create this kind of thing dynamically rather than create it statically for a specific test? > This would allow tests > to create the endpoints they need with custom behaviour without having > to extend the server, write scripts, etc. I reckon that with even a > very simple set of commands we can get a decent result. Well, it seems that you are writing some kind of script with the "actions" thing. If the point is just that you could have a custom format for gluing together headers, body, and bits of custom/library code, rather than having one python script per test that requires dynamic behaviour, that is of course possible, although we should consider the barrier to entry of having to learn a custom format vs something like from utils import sendWithDelay r = Response(200) r.addHeader("content-type: text/javascript") r.flush() sendWithDelay(r, "test.js", [2, 100, 2]) #Wait 2s send 100 bytes of file, wait 2s, send rest of file (totally made up and not based on anything that currently works)
Received on Wednesday, 7 August 2013 15:17:39 UTC