Skip to content

Commit

Permalink
Improve dev experience (#125)
Browse files Browse the repository at this point in the history
* Allow relative paths with --entrypoint

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>

* dev-requirements: Install sigstore too

This makes it easier to get started with conformance as
sigstore-python-conformance can now run in the provided virtualenv

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>

* Improve README development section

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>

---------

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
  • Loading branch information
jku authored Feb 20, 2024
1 parent 4d4933e commit 999b453
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,41 @@ invoke the client.

## Development

Running the conformance suite locally,

Easiest way to run the conformance suite locally is with the provided virtual environment:
```sh
(env) $ pytest test --entrypoint=SIGSTORE_CLIENT --identity-token=$(gh auth token)
$ make dev
$ source env/bin/activate
(env) $
```

Or if you are only checking verification use cases,
The test suite can be configured with
* `--entrypoint=$SIGSTORE_CLIENT` where SIGSTORE_CLIENT is path to a script that implements the
[CLI specification](https://github.com/sigstore/sigstore-conformance/blob/main/docs/cli_protocol.md)
* `--identity-token=$GITHUB_TOKEN` where GITHUB_TOKEN is a GitHub token with actions:read
access for public repositories (--identity-token is only required for signing tests)
* optional (and currently experimental) `--staging`: This instructs the test suite to run
against Sigstore staging infrastructure
* The environment variable `GHA_SIGSTORE_CONFORMANCE_XFAIL` can be used to
set expected results

```sh
(env) $ pytest test --skip-signing --entrypoint=SIGSTORE_CLIENT
(env) $ # run verification tests only
(env) $ pytest test --entrypoint=$SIGSTORE_CLIENT --skip-signing
(env) $ # run all tests
(env) $ pytest test --entrypoint=$SIGSTORE_CLIENT --identity-token=$GITHUB_TOKEN
```

You can also run the tests against staging by adding `--staging` on the command,

Following examples run the included sigstore-python-conformance client script and use the
[`gh` CLI](https://cli.github.com/):
```sh
(env) $ pytest test --staging --entrypoint=SIGSTORE_CLIENT
```
(env) $ # run verification tests only
(env) $ GHA_SIGSTORE_CONFORMANCE_XFAIL="test_verify_with_trust_root test_verify_dsse_bundle_with_trust_root" \
pytest test --entrypoint=sigstore-python-conformance --skip-signing
Using the [`gh` CLI](https://cli.github.com/) and noting SIGSTORE_CLIENT is the absolute path to a client implementing the [CLI specification](https://github.com/sigstore/sigstore-conformance/blob/main/docs/cli_protocol.md).
(env) $ # run all tests
(env) $ GHA_SIGSTORE_CONFORMANCE_XFAIL="test_verify_with_trust_root test_verify_dsse_bundle_with_trust_root" \
pytest test --entrypoint=sigstore-python-conformance --identity-token=$(gh auth token)
```

## Licensing

Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sigstore
ruff
black
mypy
Expand Down
4 changes: 4 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ def client(pytestconfig, identity_token):
Parametrize each test with the client under test.
"""
entrypoint = pytestconfig.getoption("--entrypoint")
if not os.path.isabs(entrypoint):
entrypoint = os.path.join(pytestconfig.invocation_params.dir, entrypoint)

staging = pytestconfig.getoption("--staging")

return SigstoreClient(entrypoint, identity_token, staging)


Expand Down

0 comments on commit 999b453

Please sign in to comment.