Skip to content

Commit

Permalink
Move all tests into this repo. Update fixtures.
Browse files Browse the repository at this point in the history
Fixture updates are from blind "-testmark.regen".
  • Loading branch information
warpfork committed Aug 24, 2023
1 parent 1cd7ebc commit baf87d5
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 21 deletions.
69 changes: 69 additions & 0 deletions app/_docs/warpforge-catalog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: "wf CLI ref: warpforge catalog"
layout: base.njk
eleventyNavigation:
parent: Warpforge CLI
order: 40
---


`warpforge catalog` command reference
=====================================

[testmark]:# (docs)
```clidoc
## NAME
warpforge catalog - Subcommands that operate on catalogs
## USAGE
warpforge catalog command [command options] [arguments...]
## COMMANDS
### init
Creates a named catalog in the root workspace
### add
Add an item to the given catalog in the root workspace. Will create a catalog if required.
### release
Add a module to the root workspace catalog as a new release
### ls
List available catalogs in the root workspace
### show
Show the contents of a module in the root workspace catalog
### bundle
Bundle required catalog items into the local workspace.
### update
Update remote catalogs in the root workspace. Will install the default warpsys catalog.
### ingest-git-tags
Ingest all tags from a git repository into a root workspace catalog entry
### generate-html
Generates HTML output for the root workspace catalog containing information on modules
### mirror
Mirror the contents of a catalog to remote warehouses
### help, h
Shows a list of commands or help for one command
## OPTIONS
#### --name=<VALUE>, -n=<VALUE>
Name of the catalog to operate on
(default: **"default"**)
#### --force, -f
Force operation, even if it causes data to be overwritten.
(default: **false**)
#### --help, -h
show help
```
97 changes: 97 additions & 0 deletions app/_docs/warpforge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: "wf CLI ref: warpforge"
layout: base.njk
eleventyNavigation:
parent: Warpforge CLI
order: 40
---


`warpforge` command reference
=============================

[testmark]:# (docs)
```clidoc
## NAME
warpforge - the everything-builder and any-environment manager
## USAGE
See subcommands for details.
## VERSION
v0.4.0
## COMMANDS
### catalog
Subcommands that operate on catalogs
### check
Check file(s) for syntax and sanity
### ferk
Starts a containerized environment for interactive use
### healthcheck
Check for potential errors in system configuration
### plan
Runs planning commands to generate inputs
### quickstart
Generate a basic module and plot
### run
Run a module or formula
### spark
Experimental RPC for getting module build status from the watch server
### status, info
Get status of workspaces and installation
### ware
Subcommands that operate on wares
### watch
Watch a module for changes to plot ingest inputs. Currently only git ingests are supported.
### help, h
Shows a list of commands or help for one command
## GLOBAL OPTIONS
#### --verbose, -v
(default: **false**)
(env var: $**WARPFORGE_DEBUG**)
#### --quiet
(default: **false**)
#### --json
Enable JSON API output
(default: **false**)
#### --trace.file=<VALUE>
Enable tracing and emit output to file
#### --trace.http.enable
Enable remote tracing over http
(default: **false**)
#### --trace.http.insecure
Allows insecure http
(default: **false**)
#### --trace.http.endpoint=<VALUE>
Sets an endpoint for remote open-telemetry tracing collection
#### --help, -h
show help
#### --version
print the version
```
5 changes: 2 additions & 3 deletions doctests/cli/docs_test.go → app/docs_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package doctests_cli
package wfapp_test

import (
"bytes"
Expand All @@ -19,8 +19,7 @@ import (
"github.com/warptools/warpforge/app/base/render"
)

// TODO: form this relationship in a more rigorous way!
const fixtureDir = "../../../warpforge-site/src/warpforge/cli/"
const fixtureDir = "_docs"

// TestCommandDocs tests all the commands and their docs to match.
// This requires the warpforge-site repo to be available.
Expand Down
5 changes: 5 additions & 0 deletions app/app_test.go → app/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import (
"github.com/warptools/warpforge/app/testutil"
)

/*
This doesn't include *all* tests that target content in the examples dir...
just the ones that also have whole-system coverage.
*/

func TestExampleDirCLI(t *testing.T) {
testutil.TestFileContainingTestmarkexec(t, "../examples/500-cli/cli.md", nil)
}
Expand Down
20 changes: 12 additions & 8 deletions examples/500-cli/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Together with the verbosity and output formatting flags used above, this will al
}
}
}
```

## Check a Module is Valid
Expand Down Expand Up @@ -214,7 +215,7 @@ The result of this will be a `RunRecord` object printed to stdout:

[testmark]:# (runformula/tags=net/stdout)
```
{ "runrecord": { "guid": "389c442f-5343-497e-b74d-d31fd487af53", "time": "22222222222", "formulaID": "zM5K3Zz8R3ioVVWZ6o6GocxPKvubAJfv4iQmDH3GCq9UjtDjHtRWrry4DRoEBPvfUEYFx1D", "exitcode": 0, "results": {} } }
{ "runrecord": { "guid": "857b9774-e251-4bbc-9268-1883919fab23", "time": 1674646900, "formulaID": "zM5K3Zz8R3ioVVWZ6o6GocxPKvubAJfv4iQmDH3GCq9UjtDjHtRWrry4DRoEBPvfUEYFx1D", "exitcode": 0, "results": {} } }
```

(Note that we've normalized some of the values in this object for testing purposes.
Expand Down Expand Up @@ -357,10 +358,10 @@ there's only one record in this map.

[testmark]:# (base-workspace/then-runmodule/stdout)
```
{ "runrecord": { "guid": "fb16d767-266a-4fc2-a4a2-b59105c1b3e7", "time": 1648067390, "formulaID": "zM5K3RvfmKy9zLfHk1T6kPafmvzAGt9Ls1QYFS4BvWTaCBgxYoJLDkkqP7SD7QWuoRTYw3j", "exitcode": 0, "results": { "test": "ware:tar:2En3zD1ho1qNeLpPryZVM1UTGnqPvnt48WY36TzCGJwSCudxPXkDtN3UuS4J3AYWAM" } } }
{ "runrecord": { "guid": "16531b2e-6087-4ecb-b48d-a377d4dace90", "time": 1648067390, "formulaID": "zM5K3Rqj146W38bBjgU8yeJ4i37YtydoZGvpsqaHbNE2akLWfDYp8vi2KAh7vvU3XdUoy12", "exitcode": 0, "results": { "test": "ware:tar:4tvpCNb1XJ3gkH25MREMPBHRWa7gLUiYt7pF6AHNbqgwBrs3btvvmijebyZrYsi6Y9" } } }
{ "runrecord": { "guid": "c7fedecf-79b7-434b-9521-bf79a210cb2d", "time": 1692910078, "formulaID": "zM5K3RvfmKy9zLfHk1T6kPafmvzAGt9Ls1QYFS4BvWTaCBgxYoJLDkkqP7SD7QWuoRTYw3j", "exitcode": 0, "results": { "test": "ware:tar:2En3zD1ho1qNeLpPryZVM1UTGnqPvnt48WY36TzCGJwSCudxPXkDtN3UuS4J3AYWAM" } } }
{ "runrecord": { "guid": "25f4a58b-2d45-4c01-b3ca-3d15165535a4", "time": 1692910079, "formulaID": "zM5K3Rqj146W38bBjgU8yeJ4i37YtydoZGvpsqaHbNE2akLWfDYp8vi2KAh7vvU3XdUoy12", "exitcode": 0, "results": { "test": "ware:tar:4tvpCNb1XJ3gkH25MREMPBHRWa7gLUiYt7pF6AHNbqgwBrs3btvvmijebyZrYsi6Y9" } } }
{ "plotresults": { "test": "tar:4tvpCNb1XJ3gkH25MREMPBHRWa7gLUiYt7pF6AHNbqgwBrs3btvvmijebyZrYsi6Y9" } }
{ "runrecord": { "guid": "10941145-2d3e-44f9-ac0c-3dd2f6b6773c", "time": 1648067391, "formulaID": "zM5K3T8946y1A7Z4ZEuoCizPdDuneUQMqXqyfxXSh93CtK3n6gzgJgz9PMTUzJiexPErUqM", "exitcode": 0, "results": {} } }
{ "runrecord": { "guid": "df7923fd-1ff6-4600-8984-f896d79610fd", "time": 1692910079, "formulaID": "zM5K3T8946y1A7Z4ZEuoCizPdDuneUQMqXqyfxXSh93CtK3n6gzgJgz9PMTUzJiexPErUqM", "exitcode": 0, "results": {} } }
{ "plotresults": { "test": "tar:4tvpCNb1XJ3gkH25MREMPBHRWa7gLUiYt7pF6AHNbqgwBrs3btvvmijebyZrYsi6Y9" } }
```

Expand Down Expand Up @@ -606,7 +607,8 @@ warpforge -v catalog bundle module.wf

[testmark]:# (base-workspace/then-bundle/output)
```
bundled "warpsys.org/busybox:v1.35.0:amd64-static"
bundled "warpsys.org/busybox:v1.35.0:amd64-static"
```

# Ferk
Expand All @@ -625,7 +627,7 @@ Check that `ferk` ran successfully, no outputs are expected.

[testmark]:# (base-workspace/then-ferk/stdout)
```
{ "runrecord": { "guid": "055a7ca6-4ea8-49d1-8053-e01e05202495", "time": 1648067779, "formulaID": "zM5K3V1fXVjExjfVd8d7ByUQ7HP16QAcZcoRd1bh3X4uvms1Xbpb87c1a7WNaw8Hw2B3uF6", "exitcode": 0, "results": { "out": "ware:tar:-" } } }
{ "runrecord": { "guid": "61940b67-024a-476e-996e-740ff80356c7", "time": 1692910079, "formulaID": "zM5K3V1fXVjExjfVd8d7ByUQ7HP16QAcZcoRd1bh3X4uvms1Xbpb87c1a7WNaw8Hw2B3uF6", "exitcode": 0, "results": { "out": "ware:tar:-" } } }
{ "plotresults": { "out": "tar:-" } }
```

Expand Down Expand Up @@ -669,7 +671,7 @@ warpforge --json --quiet ferk --plot ./plot.wf --cmd /bin/echo --no-interactive

[testmark]:# (base-workspace/then-ferk-with-plot/stdout)
```
{ "runrecord": { "guid": "5217c90a-ac1e-413a-8d55-3eac762d81e1", "time": 1669691979, "formulaID": "zM5K3YWRYqSgvxgMkAA9KbzPpqtRPbufF2z397SNJ1mKTkp9SpmxA8jD3YmTPu3EWvijMSv", "exitcode": 0, "results": {} } }
{ "runrecord": { "guid": "b964aa2f-bb7a-44c4-b4fa-bfc9d15d0ace", "time": 1692910079, "formulaID": "zM5K3YWRYqSgvxgMkAA9KbzPpqtRPbufF2z397SNJ1mKTkp9SpmxA8jD3YmTPu3EWvijMSv", "exitcode": 0, "results": {} } }
{ "plotresults": {} }
```

Expand Down Expand Up @@ -708,7 +710,7 @@ warpforge --json run
{ "log": { "Msg": "ware mount: wareId = tar:4z9DCTxoKkStqXQRwtf9nimpfQQ36dbndDsAPCQgECfbXt3edanUrsVKCjE9TkX2v9 destPath = /" } }
{ "log": { "Msg": "executing script interpreter = /bin/sh" } }
{ "log": { "Msg": "packed \"out\": path = /output wareId=tar:6U2WhgnXRCLsNjZLyvLzG6Eer5MH4MpguDeimPrEafHytjmXjbvxjm1STCuqHV5AQA" } }
{ "runrecord": { "guid": "755c9be7-ca53-4d92-a600-8bcb25fee985", "time": 1651158797, "formulaID": "zM5K3ZMzLiBwQB93yZ4nFUsVSSgVtNPjpY72hKHxDjc9FRk9KnJSoCvkHFEPWfxARdjaguZ", "exitcode": 0, "results": { "out": "ware:tar:6U2WhgnXRCLsNjZLyvLzG6Eer5MH4MpguDeimPrEafHytjmXjbvxjm1STCuqHV5AQA" } } }
{ "runrecord": { "guid": "6785b641-6e41-4ecb-9207-4ecd60b85bd6", "time": 1692910079, "formulaID": "zM5K3ZMzLiBwQB93yZ4nFUsVSSgVtNPjpY72hKHxDjc9FRk9KnJSoCvkHFEPWfxARdjaguZ", "exitcode": 0, "results": { "out": "ware:tar:6U2WhgnXRCLsNjZLyvLzG6Eer5MH4MpguDeimPrEafHytjmXjbvxjm1STCuqHV5AQA" } } }
{ "log": { "Msg": "(hello-world) collected output hello-world:out" } }
{ "log": { "Msg": "(hello-world) complete" } }
{ "plotresults": { "output": "tar:6U2WhgnXRCLsNjZLyvLzG6Eer5MH4MpguDeimPrEafHytjmXjbvxjm1STCuqHV5AQA" } }
Expand Down Expand Up @@ -790,6 +792,7 @@ warpforge ware unpack tar:4z9DCTxoKkStqXQRwtf9nimpfQQ36dbndDsAPCQgECfbXt3edanUrs

[testmark]:# (unpack/output)
```
```

[testmark]:# (unpack/then-ls/script)
Expand Down Expand Up @@ -886,6 +889,7 @@ result = {"inputs": {}, "steps": {}, "outputs": {}}

[testmark]:# (plan-generate/output)
```
```

[testmark]:# (plan-generate/then-cat/script)
Expand Down
28 changes: 18 additions & 10 deletions examples/500-cli/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@ warpforge ware unpack --help

[testmark]:# (ware_unpack/output)
```
NAME:
warpforge ware unpack - Places the contents of a ware onto the filesystem
## NAME
warpforge ware unpack - Places the contents of a ware onto the filesystem
USAGE:
warpforge ware unpack [command options] [WareID]
## USAGE
warpforge ware unpack [command options] [WareID]
DESCRIPTION:
[WareID]: a ware ID such as [packtype]:[hash]. e.g. "tar:4z9DCTxoKkStqXQRwtf9nimpfQQ36dbndDsAPCQgECfbXt3edanUrsVKCjE9TkX2v9"
## DESCRIPTION
[WareID]: a ware ID such as [packtype]:[hash]. e.g. "tar:4z9DCTxoKkStqXQRwtf9nimpfQQ36dbndDsAPCQgECfbXt3edanUrsVKCjE9TkX2v9"
## OPTIONS
#### --path=<VALUE>
Location to place the ware contents. Defaults to current directory.
#### --force
Allow overwriting the given path. Any contents of an existing directory may be lost.
(default: **false**)
#### --help, -h
show help
OPTIONS:
--path value Location to place the ware contents. Defaults to current directory.
--force Allow overwriting the given path. Any contents of an existing directory may be lost. (default: false)
--help, -h show help
```

0 comments on commit baf87d5

Please sign in to comment.