Commit Graph

173 Commits

Author SHA1 Message Date
Samantha Frank 6692160ced
test-cli: Pass -v/--verbose flag to Go integration tests (#7754)
Also remove -o/--list-integration-tests, this flag isn't really that
useful.
2024-10-10 15:26:15 -04:00
Aaron Gable 6ae6aa8e90
Dynamically generate grpc-creds at integration test startup (#7477)
The summary here is:
- Move test/cert-ceremonies to test/certs
- Move .hierarchy (generated by the above) to test/certs/webpki
- Remove our mapping of .hierarchy to /hierarchy inside docker
- Move test/grpc-creds to test/certs/ipki
- Unify the generation of both test/certs/webpki and test/certs/ipki
into a single script at test/certs/generate.sh
- Make that script the entrypoint of a new docker compose service
- Have t.sh and tn.sh invoke that service to ensure keys and certs are
created before tests run

No production changes are necessary, the config changes here are just
for testing purposes.

Part of https://github.com/letsencrypt/boulder/issues/7476
2024-05-15 11:31:23 -04:00
Jacob Hoffman-Andrews ce5632b480
Remove `service1` / `service2` names in consul (#7266)
These names corresponded to single instances of a service, and were
primarily used for (a) specifying which interface to bind a gRPC port on
and (b) allowing `health-checker` to check individual instances rather
than a service as a whole.

For (a), change the `--grpc-addr` flags to bind to "all interfaces." For
(b), provide a specific IP address and port for health checking. This
required adding a `--hostOverride` flag for `health-checker` because the
service certificates contain hostname SANs, not IP address SANs.

Clarify the situation with nonce services a little bit. Previously we
had one nonce "service" in Consul and got nonces from that (i.e.
randomly between the two nonce-service instances). Now we have two nonce
services in consul, representing multiple datacenters, and one of them
is explicitly configured as the "get" service, while both are configured
as the "redeem" service.

Part of #7245.

Note this change does not yet get rid of the rednet/bluenet distinction,
nor does it get rid of all use of 10.88.88.88. That will be a followup
change.
2024-01-22 09:34:20 -08:00
Phil Porada 442b906ee8
test: dont overlap ca2 and va2 debug ports (#7257)
https://github.com/letsencrypt/boulder/pull/7246 introduced
using different ports for instances of the same service. CA2 and VA2
accidentally configured the same debug port.
2024-01-11 12:57:35 -08:00
Aaron Gable ea9291a4d3
Remove slow query test (#7211)
This test has been "temporarily" disabled for four years. In the mean
time, our approach to the database has changed drastically. Remove it,
since it is likely not worth the effort to re-enable it.

Fixes https://github.com/letsencrypt/boulder/issues/4625
Fixes https://github.com/letsencrypt/boulder/issues/4583
2023-12-13 13:52:52 -08:00
Jacob Hoffman-Andrews 2041e8723b
integration: shorten log output (#6894)
Remove the load test stage of the integration test, which generates
superfluous amounts of log.

Turn down logging on the CA and VA from info to error-only.

Part of https://github.com/letsencrypt/boulder/issues/6890
2023-06-05 13:11:19 -04:00
Aaron Gable 4305f64a28
Replace integration test root ocsp with crls (#6905)
We no longer issue OCSP responses for our intermediate certificates,
instead producing CRLs which cover those intermediates. Remove the OCSP
response from our integration test ceremony, remove the configuration
for the static ocsp-responder which serves that response, and remove the
integration test which spins up and checks that responder. Replace all
of the above with new CRLs generated as part of the integration test
ceremony.
2023-05-24 14:22:43 -07:00
Samantha 511f5b79f1
test: Add ProxySQL to our Docker development stack (#6754)
Add an upstream ProxySQL container to our docker-compose. Configure
ProxySQL to manage database connections for our unit and integration
tests.

Fixes #5873
2023-03-29 18:41:24 -04:00
Matthew McPherrin 1d16ff9b00
Add support for subcommands to "boulder" command (#6426)
Boulder builds a single binary which is symlinked to the different binary names, which are included in its releases.
However, requiring symlinks isn't always convenient.

This change makes the base `boulder` command usable as any of the other binary names.  If the binary is invoked as boulder, runs the second argument as the command name.  It shifts off the `boulder` from os.Args so that all the existing argument parsing can remain unchanged.

This uses the subcommand versions in integration tests, which I think is important to verify this change works, however we can debate whether or not that should be merged, since we're using the symlink method in production, that's what we want to test.

Issue #6362 suggests we want to move to a more fully-featured command-line parsing library that has proper subcommand support. This fixes one fragment of that, by providing subcommands, but is definitely nowhere near as nice as it could be with a more fully fleshed out library.  Thus this change takes a minimal-touch approach to this change, since we know a larger refactoring is coming.
2022-10-06 11:21:47 -07:00
Samantha 90eb90bdbe
test: Replace sd-test-srv with consul (#6389)
- Add a dedicated Consul container
- Replace `sd-test-srv` with Consul
- Add documentation for configuring Consul
- Re-issue all gRPC credentials for `<service-name>.service.consul`

Part of #6111
2022-09-19 16:13:53 -07:00
Jacob Hoffman-Andrews 1047c4cf7a
Remove chisel.py (#5986)
This was used for ACMEv1 and is not needed anymore.

Also update some outdated references in chisel2.py.
2022-03-11 08:39:06 -08:00
Aaron Gable 5c02deabfb
Remove wfe1 integration tests (#5840)
These tests are testing functionality that is no longer in use in
production deployments of Boulder. As we go about removing wfe1
functionality, these tests will break, so let's just remove them
wholesale right now. I have verified that all of the tests removed in
this PR are duplicated against wfe2.

One of the changes in this PR is to cease starting up the wfe1 process
in the integration tests at all. However, that component was serving
requests for the AIA Issuer URL, which gets queried by various OCSP and
revocation tests. In order to keep those tests working, this change also
adds an integration-test-only handler to wfe2, and updates the CA
configuration to point at the new handler.

Part of #5681
2021-12-10 12:40:22 -08:00
Jacob Hoffman-Andrews ba0ea090b2
integration: save hierarchy across runs (#5729)
This allows repeated runs using the same hiearchy, and avoids spurious
errors from ocsp-updater saying "This CA doesn't have an issuer cert
with ID XXX"

Fixes #5721
2021-10-20 17:06:33 -07:00
Jacob Hoffman-Andrews d3302cbb50
Separate install / build steps of tests. (#5714)
Previously, `starservers.start()` would implicitly build the binaries.
This separates the `startservers.install()` step as a separate one that
must happen first. This is useful because it allows us to ensure the
`ceremony` tool has been built before we run `setupHierarchy`.

Also, add a `-s` flag to `curl` when checking whether start.py resulted
in a successful startup. This reduces the amount of log spam when it
failed to come up.
2021-10-15 09:30:55 -07:00
Aaron Gable 1c6842cf69
Delete expired-authz-purger2 (#5570)
Delete the expired-authz-purger2 binary, as well as the
various config files, tests, and test helpers that exist to
support it.

This utility is no longer necessary, as it has not been
running for quite some time, and we have developed
alternative means of keeping the growth of the authz
table under control.

Fixes #5568
2021-08-11 14:39:57 -07:00
Aaron Gable ac3e5e70c4
Delete boulder-janitor (#5571)
Delete the boulder-janitor binary, and the various configs
and tests which exist to support it.

This tool has not been actively running in quite some time.
The tables which is covers are either supported by our
more recent partitioning methods, or are rate-limit tables
that we hope to move out of mysql entirely. The cost of
maintaining the janitor is not offset by the benefits it brings
us (or the lack thereof).

Fixes #5569
2021-08-11 11:10:24 -07:00
Samantha 35340ff67a
Move expired-authz-purger2 config to test directory (#5352)
- Edit integration test to start expired-authz-purger2 with config/
  config-next
- Move config from `cmd/expired-authz-purger2/config.json` to
  `test/config/expired-authz-purger2.json`
- Add a copy of `test/config/expired-authz-purger2.json` to
  `test/config-next/`

Fixes #5351
2021-03-18 17:56:25 -07:00
Samantha 409fe7acc3
test: wrap existing test.sh with an opt parser and improve UX (#5155)
Modifies test.sh to provide a long and short option flagged menu
with helpful documentation. Improves UX by printing the settings
used before each run. Improves visual parsability by printing a
bold blue section heading with a title for each test. Using set flags
-eu and an EXIT trap we now exit at any failure or undefined var
and print FAILURE in red on the last line. If the script doe not exit
prematurely, then SUCCESS is printed in green on the last line.

Adds the following options: Parse and print a full list of available
integration tests. Enable the -race flag for unit tests. Enable next
config. Flag to add integration test and unit test filter arguments.

Fixes, -race flag not being enabled by the previous tests. The script
comments seem to indicate that this is desirable, but either through
error or intention TRAVIS was never being set to true, I confirmed
this behavior by running CI tests and observing which options were
set before making this change. If this is not desirable, we can make
a change in .travis.yml to omit the -e flag on unit test and unit test
with next-config.

Fixed dir var not being set. Since the previous script did not use the
set -u flag, undefined vars would not cause an exit. Once this flag was
set it was apprent that var dir was never being defined. Instead, the
script was just using .coverprofile for the coverage test option.

Removes FAILURE and SUCCESS on exit from the Python wrapper
in test/integration-test.py.

Modifies .travis.yml to to use the new short option flags instead of
environment variables. Included comments here to describe all of
the available flags.

Modifies README.md to add examples of the new script in use as
well as examples of running tests without the new script. This should
give folks a good idea of what the script is wrapping.

Part of #5139
2020-11-10 11:10:53 -08:00
Aaron Gable dea2f6ef92
Refactor and cleanup python integration tests (#4945) 2020-07-13 14:31:15 -07:00
Roland Bracewell Shoemaker c4813cc340
cmd/ceremony: merge single-ocsp tool into ceremony (#4878)
Fixes #4658.
2020-06-23 11:30:31 -07:00
Roland Bracewell Shoemaker 7f3c0f61a3
cmd/single-ocsp: validate issuer/responder are valid to sign the response (#4855)
Fixes #4853
2020-06-11 17:11:29 -07:00
Jacob Hoffman-Andrews 18e7a57e24
Improve integration tests. (#4847)
Add passthrough for certain environment variables to
docker-compose.yml, making it easier to set them:

    RUN=unit docker-compose run --use-aliases boulder ./test.sh

Use 4001 instead of 4443 to monitor boulder-wfe2's health. This avoids
a spurious error log about a failed TLS handshake.

Remove unused code around running Certbot in integation tests.
2020-06-04 19:43:28 -07:00
Roland Bracewell Shoemaker 2df78800e2
Setup issuance hierarchy in startservers.py (#4846)
Once we de-dupe startservers.install calls we may want to move
setupHierarchy there, but for now we need to call it from
integration-test.py and start.py.

Fixes #4842
2020-06-04 14:53:02 -07:00
Roland Bracewell Shoemaker 7673f02803
Use cmd/ceremony in integration tests (#4832)
This ended up taking a lot more work than I expected. In order to make the implementation more robust a bunch of stuff we previously relied on has been ripped out in order to reduce unnecessary complexity (I think I insisted on a bunch of this in the first place, so glad I can kill it now).

In particular this change:

* Removes bhsm and pkcs11-proxy: softhsm and pkcs11-proxy don't play well together, and any softhsm manipulation would need to happen on bhsm, then require a restart of pkcs11-proxy to pull in the on-disk changes. This makes manipulating softhsm from the boulder container extremely difficult, and because of the need to initialize new on each run (described below) we need direct access to the softhsm2 tools since pkcs11-tool cannot do slot initialization operations over the wire. I originally argued for bhsm as a way to mimic a network attached HSM, mainly so that we could do network level fault testing. In reality we've never actually done this, and the extra complexity is not really realistic for a handful of reasons. It seems better to just rip it out and operate directly on a local softhsm instance (the other option would be to use pkcs11-proxy locally, but this still would require manually restarting the proxy whenever softhsm2-util was used, and wouldn't really offer any realistic benefit).
* Initializes the softhsm slots on each integration test run, rather than when creating the docker image (this is necessary to prevent churn in test/cert-ceremonies/generate.go, which would need to be updated to reflect the new slot IDs each time a new boulder-tools image was created since slot IDs are randomly generated)
* Installs softhsm from source so that we can use a more up to date version (2.5.0 vs. 2.2.0 which is in the debian repo)
* Generates the root and intermediate private keys in softhsm and writes out the root and intermediate public keys to /tmp for use in integration tests (the existing test-{ca,root} certs are kept in test/ because they are used in a whole bunch of unit tests. At some point these should probably be renamed/moved to be more representative of what they are used for, but that is left for a follow-up in order to keep the churn in this PR as related to the ceremony work as possible)
Another follow-up item here is that we should really be zeroing out the database at the start of each integration test run, since certain things like certificates and ocsp responses will be signed by a key/issuer that is no longer is use/doesn't match the current key/issuer.

Fixes #4832.
2020-06-03 15:20:23 -07:00
Roland Bracewell Shoemaker 8259925f7c
Allow passing only --gotest to integration-test.py (#4786) 2020-04-20 13:32:30 -07:00
Jacob Hoffman-Andrews 5af7541c85
Improve output when Go integration tests fail. (#4734)
Right now we show output like:

Traceback (most recent call last):
File "test/integration-test.py", line 60, in run_go_tests
subprocess.check_call(cmdLine, shell=False, stderr=subprocess.STDOUT)
File "/usr/lib/python3.5/subprocess.py", line 271, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['go', 'test', '-tags', 'integration', '-count=1', '-race', './test/integration']' returned non-zero exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test/integration-test.py", line 414, in
main()
File "test/integration-test.py", line 293, in main
run_go_tests(args.test_case_filter)
File "test/integration-test.py", line 62, in run_go_tests
raise(Exception("%s. Output:\n%s" % (e, e.output)))
Exception: Command '['go', 'test', '-tags', 'integration', '-count=1', '-race', './test/integration']' returned non-zero exit status 1. Output:
None

This change removes the try / raise clauses that were causing this
double exception logging. The original purpose of these clauses was to
make sure we logged output on failure. To continue to fulfill that
purpose, I switched the run function to use check_call instead of
check_output. check_output captures the stdout; check_call emits it to
the caller's stdout as normal, so we still see the output.

I also changed the two cases that actually wanted to process output so
they use check_output directly.
2020-04-06 17:42:40 -07:00
Jacob Hoffman-Andrews 499c73c23b
CI: Optionally disable race detection with env var. (#4674)
This significantly speeds up iteration on integration tests.
2020-02-10 12:27:20 -05:00
Jacob Hoffman-Andrews 1be1986894 SA: Rename authz2Model to authzModel. (#4648)
Also remove unused helper functions selectPendingAuthz and selectAuthz,
and pendingAuthzModel and the previously defined but now unused
authzModel.
2020-01-17 17:19:15 -05:00
Jacob Hoffman-Andrews 46cbe54b17
Temporarily disable slow query test for flakiness (#4636)
Part of #4625
2020-01-07 14:32:36 -08:00
Jacob Hoffman-Andrews c79542fa5a test: Add exclusion for GetValidOrderAuthorizations2 slow query. (#4598)
This was causing intermittent failures.
2019-12-05 09:13:46 -05:00
Jacob Hoffman-Andrews e29830ac33 test: Add a decode() to check_output for slow queries. (#4589)
In Python3, the output of subprocess.check_output is of type bytes.
That means calling print() on the output will print \n instead of an
actual newline. This PR adds decoding to the output of mysql in the slow
query test, bringing it into line with other check_output calls.

This also removes a redundant "def run" that is shadowed by the
definition in helpers.py (and was also missing a decode() call).
2019-12-03 09:10:05 -05:00
Jacob Hoffman-Andrews 1146eecac3 integration: use python3 (#4582)
Python 2 is over in 1 month 4 days: https://pythonclock.org/

This rolls forward most of the changes in #4313.

The original change was rolled back in #4323 because it
broke `docker-compose up`. This change fixes those original issues by
(a) making sure `requests` is installed and (b) sourcing a virtualenv
containing the `requests` module before running start.py.

Other notable changes in this:
 - Certbot has changed the developer instructions to install specific packages
rather than rely on `letsencrypt-auto --os-packages-only`, so we follow suit.
 - Python3 now has a `bytes` type that is used in some places that used to
provide `str`, and all `str` are now Unicode. That means going from `bytes` to
`str` and back requires explicit `.decode()` and `.encode()`.
 - Moved from urllib2 to requests in many places.
2019-11-28 09:54:58 -05:00
Jacob Hoffman-Andrews 211985eae7 integration: Fail tests on unindexed queries. (#4581)
Also incidentally remove the database flag from the mysql invocation
since it was unnecessary.

Fixes #4406
2019-11-27 13:19:36 -05:00
Jacob Hoffman-Andrews 70a9bf32d8 integration: allow-list a known-slow SQL query. (#4580)
We intentionally use a SLEEP in a SQL query to trigger timeout behavior.
This caused integration tests failures locally (where unittests are run
in the same session as integration tests).
2019-11-26 14:46:40 -05:00
Daniel McCarney 4e9ab5f04e
deps: update to eggsampler/acme/v3, run tidy, re-enable parallel tests (#4568)
This updates the `github.com/eggsampler/acme` dependency used in our Go-based
integration tests to v3. Notably this fixes a data race we encountered in CI.
With the data race fixed this branch can also revert
54a798b7f6 and resolve
https://github.com/letsencrypt/boulder/issues/4542

I ran a `go mod tidy` to cleanup the old `v2` copy of the dep and it also
removed a few stale cfssl/mysql items from the `go.mod`.

Upstream library's tests are confirmed to pass:
```
~/go/src/github.com/eggsampler/acme$ git log --pretty=format:'%h' -n 1
b581dc6

~/go/src/github.com/eggsampler/acme$ make pebble
mkdir -p /home/daniel/go/src/github.com/letsencrypt/pebble
git clone --depth 1 https://github.com/letsencrypt/pebble.git /home/daniel/go/src/github.com/letsencrypt/pebble \
	|| (cd /home/daniel/go/src/github.com/letsencrypt/pebble; git checkout -f master && git reset --hard HEAD && git pull -q)
fatal: destination path '/home/daniel/go/src/github.com/letsencrypt/pebble' already exists and is not an empty directory.
Already on 'master'
Your branch is up-to-date with 'le/master'.
HEAD is now at 6c2d514 wfe: compare Identifier.Type with acme.IndentifierIP (#287)
docker-compose -f /home/daniel/go/src/github.com/letsencrypt/pebble/docker-compose.yml up -d
Creating network "pebble_acmenet" with driver "bridge"
Creating pebble_challtestsrv_1 ... done
Creating pebble_pebble_1       ... done
while ! wget --delete-after -q --no-check-certificate "https://localhost:14000/dir" ; do sleep 1 ; done
go clean -testcache
go test -race -coverprofile=coverage_18.txt -covermode=atomic github.com/eggsampler/acme/v3
ok  	github.com/eggsampler/acme/v3	24.292s	coverage: 83.0% of statements
docker-compose -f /home/daniel/go/src/github.com/letsencrypt/pebble/docker-compose.yml down
Stopping pebble_pebble_1       ... done
Stopping pebble_challtestsrv_1 ... done
Removing pebble_pebble_1       ... done
Removing pebble_challtestsrv_1 ... done
Removing network pebble_acmenet
```
2019-11-21 09:23:12 -05:00
Jacob Hoffman-Andrews 36e504f21f integration: log slow queries and check for them (#4554)
I couldn't get this to work cleanly with
`--log-queries-not-using-indexes` because a couple of queries show up
during integration test runs, seemingly because the tables involved are
small enough that the optimizer finds it faster to skip the index.

Some possible followups:
 - Allow list those queries, or
 - Preload the DB with a certain number of certificates before the start
   of testing.
2019-11-19 13:44:24 -05:00
Daniel McCarney df059e093b
janitor: add cleanup of Orders and assoc. rows. (#4544)
The `boulder-janitor` is extended to cleanup rows from the `orders` table that
have expired beyond the configured grace period, and the associated referencing
rows in `requestedNames`, `orderFqdnSets`, and `orderToAuthz2`.

To make implementing the transaction work for the deletions easier/consistent
I lifted the SA's `WithTransaction` code and assoc. functions to a new shared
`db` package. This also let me drop the one-off `janitorDb` interface from the
existing code.

There is an associated change to the `GRANT` statements for the `janitor` DB
user to allow it to find/delete the rows related to orders.

Resolves https://github.com/letsencrypt/boulder/issues/4527
2019-11-13 13:47:55 -05:00
Roland Bracewell Shoemaker 54a798b7f6 tests: temporarily disable race detector for golang int. tests (#4543) 2019-11-11 14:47:54 -05:00
Roland Bracewell Shoemaker 6f71c0c453 tests: run golang integration tests in parallel w/ race detector (#4533) 2019-11-08 15:10:21 -05:00
Jacob Hoffman-Andrews 0c9ca050ab Tidy up default_config_dir in integration test (#4509)
We now expect that the config dir is always set, so we make that
explicit in the integration test and error if that's not true.

This change also renames the variable to just "config_dir", and removes
the parameter to startservers.start, which is currently never set to
anything other than its default value.

This also explicitly sets the environment variable in .travis.yml.
2019-10-25 09:51:48 -07:00
Daniel McCarney d35c20db75 boulder-janitor: switch workbatch gauge to counter. (#4477)
A gauge wasn't the appropriate stat type choice for this usage.

Switching the stat to be a counter instead of a gauge means we can't
detect when the janitor is finished its work in the integration test by
watching for this stat to drop to zero for all the table labels we're
concerned with. Instead the test is updated to watch for the counter
value to stabilize for a period longer than the workbatch sleep.
2019-10-11 14:40:59 -07:00
Roland Bracewell Shoemaker 8d877d93b2
boulder-janitor: Calculate expiry cutoff in code rather than th… (#4439)
Fixes #4431.
2019-09-23 12:33:54 -07:00
Daniel McCarney eb8dd08791
test: don't eat go test stdout, support filter. (#4432)
* Use `check_call` instead of `check_output`, we don't care about
capturing the output and instead want it to go to stdout so test
failures can be debugged.

* Don't use `shell=True`, it isn't needed here.

* Pipe through the test case filter so that it can be used with
`--test.run` to limit the Go integration tests run.
2019-09-13 14:19:23 -04:00
Jacob Hoffman-Andrews a8586d05cd
Add integration test for precertificate OCSP. (#4417)
This test adds support in ct-test-srv for rejecting precertificates by
hostname, in order to artificially generate a condition where a
precertificate is issued but no final certificate can be issued. Right
now the final check in the test is temporarily disabled until the
feature is fixed.

Also, as our first Go-based integration test, this pulls in the
eggsampler/acme Go client, and adds some suport in integration-test.py.

This also refactors ct-test-srv slightly to use a ServeMux, and fixes
a couple of cases of not returning immediately on error.
2019-09-06 13:35:08 -07:00
Jacob Hoffman-Andrews bdd29a1e27
Promote authzv2 to test/config now that it's live (#4421)
This also removes some awkward dancing we did in integration_test.py to
run setup_twenty_days_ago under the opposite config of whatever we were
about to run tests under.

Reverts most of #4288 and #4290.
2019-09-05 12:33:56 -07:00
Jacob Hoffman-Andrews b7250c1d43
integration: test for DisableAuthz2Orders. (#4390)
To make this work, I changed the twenty_days_ago setup to use
`config-next` when the main test phase is running `config`. That, in
turn, made the recheck_caa test fail, so I added a tweak to that.

I also moved the authzv2 migrations into `db`. Without that change,
the integration test would fail during the twenty_days_ago setup because
Boulder would attempt to create authzv2 objects but the table wouldn't
exist yet.
2019-08-08 17:07:29 -07:00
Roland Bracewell Shoemaker db01830508
Return OCSP unauthorized status if the certificate is expired (#4380)
The ocsp-updater ocspStaleMaxAge config var has to be bumped up to ~7 months so that when it is run after the six-months-ago run it will actually update the ocsp responses generated during that period and mark the certificate status row as expired.

Fixes #4338.
2019-08-01 14:13:27 -07:00
Daniel McCarney bb005e1c79
integration: add test for boulder-janitor. (#4364) 2019-07-29 16:13:10 -04:00
Jacob Hoffman-Andrews 98677b83d8 integration: make test case filter better (#4366) 2019-07-29 09:00:02 -07:00
Jacob Hoffman-Andrews 3af49a16be
Revert "integration: move to Python3 (#4313)" (#4323)
This reverts commit 796a7aa2f4.

People's tests have been breaking on `docker-compose up` with the following output:

```
ImportError: No module named requests
```

Fixes #4322
2019-07-03 11:35:45 -07:00