mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
The RPC handlers expect to see `nil` ACL objects whenever ACLs are disabled. By using `nil` as a sentinel value, we have the risk of nil pointer exceptions and improper handling of `nil` when returned from our various auth methods that can lead to privilege escalation bugs. This patchset is the first in a series to eliminate the use of `nil` ACLs as a sentinel value for when ACLs are disabled. This one is entirely refactoring to reduce the burden of reviewing the final patchsets that have the functional changes: * Move RPC auth into a new `nomad/auth` package, injecting the dependencies required from the server. Expose only those public methods on `nomad/auth` that are intended for use in the RPC handlers. * Keep the existing large authentication test as an integration test. * Add unit tests covering the methods of `nomad/auth` we intend on keeping. The assertions for many of these will change once we have no `nil` sentinels and can make safe assertions about permissions on the resulting `ACL` objects.
CI (unit testing)
This README describes how the Core CI Tests Github Actions works, which provides Nomad with continuous integration unit testing.
Steps
-
When a branch is pushed, GHA triggers
.github/workflows/test-core.yaml. -
The first job is
modswhich creates a pre-cache of Go modules.
- Only useful for the followup jobs on Linux runners
- Is keyed on
hash(go.sum), so a cache is re-used until deps are modified.
- The
checks,test-api,test-*jobs are started.
- The checks job runs
make check - The test job runs groups of tests, see below
3i. The check step also runs make missing
- Invokes
tools/missingto scanci/test-cores.json&& nomad source. - Fails the build if any packages in Nomad are not covered.
4a. The test-* jobs are run.
- Configured as a matrix of "groups"; each group is a set of packages.
- The GHA invokes
test-nomadwith $GOTEST_GROUP for each group. - The makefile uses
tools/missingto translate the group into packages - Package groups are configured in
ci/test-core.json
4b. The test-api job is run.
- Because
apiis a submodule, invokation of test command is special. - The GHA invokes
test-nomad-modulewith the name of the submodule.
- The
compilejobs are run
- Waits on checks to complete first
- Runs on each of
linux,macos,windows