Skip to content

Add a test facility for testing resources and graphs #868

@purpleidea

Description

@purpleidea

We have a pretty good test facility for testing the language and the function engine in TestAstFunc2 (and similar). We'd like to build something similarly good for testing resources and resource graphs. It will be challenging to have something that makes it both easy to write tests succinctly, but also which can run hundreds of tests of many resources each, and which doesn't cause interference with subsequent tests, since, as we know, resources often change the state of the machine, or which causes excessive slowness (eg: spawning new vm's for each test) since that would be too slow.

It is highly likely that we'll want to use the txtar format, similarly to how we did with TestAstFunc2. Alternate proposals for the structure of the test are welcome if there is a better approach available.

For example we want to test that a user resource with particular params produces a desired result on a machine. Or that a certain combination of params causes an error at resource Validation, or that a certain resource with certain params will error, and so on.

Keep in mind that testing some kinds of resources like "http:server:ui" might be outside the scope of this test infra. Other kinds such as "kv" might be more challenging and it's fine to either include these in this test infra, or leave them and the other "world" resources for another more specialized piece of infra.

Please propose a design, including specifically some example "pseudo code" tests before implementing the whole project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    hackerThis will require expert use of golang, mgmt, concurrency, algorithms, or even complicated testing.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions