github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/tests/integration/spec.bats (about)

     1  #!/usr/bin/env bats
     2  
     3  load helpers
     4  
     5  function setup() {
     6  	setup_busybox
     7  	update_config '.process.args = ["/bin/echo", "Hello World"]'
     8  }
     9  
    10  function teardown() {
    11  	teardown_bundle
    12  }
    13  
    14  @test "spec generation cwd" {
    15  	runc run test_hello
    16  	[ "$status" -eq 0 ]
    17  }
    18  
    19  @test "spec generation --bundle" {
    20  	runc run --bundle "$(pwd)" test_hello
    21  	[ "$status" -eq 0 ]
    22  }
    23  
    24  @test "spec validator" {
    25  	requires rootless_no_features
    26  
    27  	SPEC_VERSION=$(awk '$1 == "github.com/opencontainers/runtime-spec" {print $2}' "$BATS_TEST_DIRNAME"/../../go.mod)
    28  	# Will look like this when not pinned to specific tag: "v0.0.0-20190207185410-29686dbc5559", otherwise "v1.0.0"
    29  	SPEC_COMMIT=$(cut -d "-" -f 3 <<<"$SPEC_VERSION")
    30  	SPEC_REF=$([[ -z "$SPEC_COMMIT" ]] && echo "$SPEC_VERSION" || echo "$SPEC_COMMIT")
    31  
    32  	git clone https://github.com/opencontainers/runtime-spec.git
    33  	(cd runtime-spec && git reset --hard "$SPEC_REF")
    34  
    35  	cd runtime-spec/schema
    36  	go mod init runtime-spec
    37  	go mod tidy
    38  	go build ./validate.go
    39  
    40  	./validate config-schema.json ../../config.json
    41  }