get.porter.sh/porter@v1.3.0/pkg/storage/migrations/helpers.go (about)

     1  package migrations
     2  
     3  import (
     4  	"get.porter.sh/porter/pkg/config"
     5  	"get.porter.sh/porter/pkg/secrets"
     6  	"get.porter.sh/porter/pkg/storage"
     7  )
     8  
     9  type TestManager struct {
    10  	*Manager
    11  
    12  	testStore storage.TestStore
    13  }
    14  
    15  func NewTestManager(c *config.TestConfig) *TestManager {
    16  	testStore := storage.NewTestStore(c)
    17  	m := &TestManager{
    18  		testStore: testStore,
    19  		Manager:   NewManager(c.Config, testStore),
    20  	}
    21  	ps := storage.NewTestParameterProvider(c.TestContext.T)
    22  	ss := secrets.NewTestSecretsProvider()
    23  	sanitizer := storage.NewSanitizer(ps, ss)
    24  	m.Initialize(sanitizer)
    25  	return m
    26  }
    27  
    28  func (m *TestManager) Close() error {
    29  	return m.testStore.Close()
    30  }
    31  
    32  // SetSchema allows tests to pre-emptively set the schema document.
    33  func (m *TestManager) SetSchema(schema storage.Schema) {
    34  	m.schema = schema
    35  	m.initialized = true
    36  }