github.com/GoogleCloudPlatform/testgrid@v0.0.174/cmd/README.md (about)

     1  # TestGrid Components
     2  
     3  The `cmd` directory contains the main files for TestGrid components, and documentation for how to
     4  run them. For specifics on a particular component, see the subdirectory for that component.
     5  
     6  ## Tips for running locally
     7  
     8  ### Google Cloud Storage (GCS) Authentication
     9  
    10  If you're using files from GCS and you hit an authentication or 'unauthorized' error in logs, run:
    11  ```gcloud auth application-default login```
    12  
    13  Most components will automatically find and use the credentials generated from this.
    14  
    15  ### Common Flags
    16  
    17  Most components have similar flags and defaults. Here's a few you can expect to use:
    18  - Run `bazelisk run //cmd/$COMPONENT -- --help` for full flag list and descriptions.
    19  - `--config` specifies the path to a valid [config proto]. It can take a:
    20    - local file: e.g. `/tmp/testgrid/my-config.pb`
    21    - GCS (Google Cloud Storage) file: e.g. `gs://my-bucket/my-config.pb`
    22  - `--confirm`, if true, writes data to the same base path as your `--config`.
    23    - Without this, it's "dry-run` by default and doesn't write data anywhere.
    24  - `--wait`, if true, runs the component continuously until force-quit, waiting the specified time
    25    before beginning another cycle.
    26    - Without this, it will run once and exit.
    27  - `--debug` or `--trace` print debug-level or trace-level logs, respectively.
    28    - Without this, only logs at info-level or higher will be displayed.
    29    - Debug logs tend to be useful for development or debugging.
    30    - Trace logs can be _very_ noisy, and tend to be useful for debugging something very specific.
    31  
    32  ### Developing and Testing
    33  
    34  Most of the TestGrid libraries used for these components live under the `pkg/` directory.
    35  - e.g. `cmd/updater` library code is under `pkg/updater`
    36  
    37  To run unit tests for a particular component, run:
    38  
    39  ```shell
    40  COMPONENT={component} # e.g. 'updater', 'summarizer', etc. 
    41  bazelisk test //cmd/$COMPONENT/... # Runs unit tests for the main/binary, like flag-parsing or default arguments
    42  bazelisk test //pkg/$COMPONENT/... # Runs unit tests for library code
    43  ```