github.com/GoogleContainerTools/skaffold/v2@v2.13.2/docs-v2/content/en/docs/testers/structure.md (about)

     1  ---
     2  title: "Container Structure Test"
     3  linkTitle: "Container Structure Test"
     4  weight: 20
     5  featureId: test.structure
     6  aliases: [/docs/pipeline-stages/testers/structure]
     7  ---
     8  
     9  It's common practice to validate built container images before deploying them to our cluster.
    10  To do this, Skaffold has an integrated testing phase between the build and deploy phases of the pipeline.
    11  Natively, Skaffold has support for running [container-structure-tests](https://github.com/GoogleContainerTools/container-structure-test)
    12  on built images, which validate the structural integrity of container images.
    13  The container-structure-test [binary](https://github.com/GoogleContainerTools/container-structure-test/releases)
    14  must be installed to run these tests.
    15  
    16  Structure tests are defined per image in the Skaffold config.
    17  Every time an artifact is rebuilt, Skaffold runs the associated structure tests on that image.
    18  If the tests fail, Skaffold will not continue on to the deploy stage.
    19  If frequent tests are prohibitive, long-running tests should be moved to a dedicated Skaffold profile.
    20  Users can opt out of running container structure tests by using the `--skip-tests` flag.
    21  
    22  ### Example
    23  This following example shows the `test` section from a `skaffold.yaml`.
    24  It instructs Skaffold to run all container structure tests in the `structure-test` folder relative to the Skaffold root directory:
    25  
    26  {{% readfile file="samples/testers/structure/test.yaml" %}}
    27  
    28  The files matched by the `structureTests` key are `container-structure-test` test configurations, such as:
    29  
    30  {{% readfile file="samples/testers/structure/structureTest.yaml" %}}
    31  
    32  For a reference how to write container structure tests, see its [documentation](https://github.com/GoogleContainerTools/container-structure-test#command-tests).
    33  
    34  In order to restrict the executed structure tests, a `profile` section can override the file pattern:
    35  
    36  {{% readfile file="samples/testers/structure/testProfile.yaml" %}}
    37  
    38  User can customize `container-structure-test` behavior by passing a list of configuration flags as a value of `structureTestsArgs` yaml property in `skaffold.yaml`, e.g.:
    39  
    40  {{% readfile file="samples/testers/structure/structureTestArgs.yaml" %}}
    41  
    42  To execute the tests once, run `skaffold test --profile quickcheck`.