github.com/mika/distribution@v2.2.2-0.20160108133430-a75790e3d8e0+incompatible/registry/storage/driver/rados/rados_test.go (about)

     1  // +build include_rados
     2  
     3  package rados
     4  
     5  import (
     6  	"os"
     7  	"testing"
     8  
     9  	storagedriver "github.com/docker/distribution/registry/storage/driver"
    10  	"github.com/docker/distribution/registry/storage/driver/testsuites"
    11  
    12  	"gopkg.in/check.v1"
    13  )
    14  
    15  // Hook up gocheck into the "go test" runner.
    16  func Test(t *testing.T) { check.TestingT(t) }
    17  
    18  func init() {
    19  	poolname := os.Getenv("RADOS_POOL")
    20  	username := os.Getenv("RADOS_USER")
    21  
    22  	driverConstructor := func() (storagedriver.StorageDriver, error) {
    23  		parameters := DriverParameters{
    24  			poolname,
    25  			username,
    26  			defaultChunkSize,
    27  		}
    28  
    29  		return New(parameters)
    30  	}
    31  
    32  	skipCheck := func() string {
    33  		if poolname == "" {
    34  			return "RADOS_POOL must be set to run Rado tests"
    35  		}
    36  		return ""
    37  	}
    38  
    39  	testsuites.RegisterSuite(driverConstructor, skipCheck)
    40  }