integration

package
v0.0.0-...-5597880 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProductAreaOceanicID   = uuid.MustParse("00000000-0000-0000-0000-000000000001")
	ProductAreaOceanicName = "Oceanic"

	ProductAreaCostalID   = uuid.MustParse("00000000-0000-0000-0000-000000000002")
	ProductAreaCostalName = "Costal"

	TeamSeagrassID   = uuid.MustParse("00000000-0000-0000-0000-000000000003")
	TeamSeagrassName = "Seagrass"

	TeamReefID   = uuid.MustParse("00000000-0000-0000-0000-000000000004")
	TeamReefName = "Reef"

	GroupNameReef  = "reef"
	GroupEmailReef = "reef@nav.no"

	UserOneName        = "User Userson"
	UserOneEmail       = "user.userson@email.com"
	UserTwoName        = "Another Userson"
	UserTwoEmail       = "another.userson@email.com"
	GroupNameNada      = "nada"
	GroupEmailNada     = "nada@nav.no"
	NaisTeamNada       = "nada"
	GroupNameAllUsers  = "all-users"
	GroupEmailAllUsers = "all-users@nav.no"

	Project       = "test-project"
	Location      = "europe-north1"
	PseudoDataSet = "pseudo-test-dataset"

	UserOne = &service.User{
		Name:  UserOneName,
		Email: UserOneEmail,
		GoogleGroups: []service.Group{
			{
				Name:  GroupNameNada,
				Email: GroupEmailNada,
			},
			{
				Name:  GroupNameAllUsers,
				Email: GroupEmailAllUsers,
			},
		},
	}

	UserTwo = &service.User{
		Name:  UserTwoName,
		Email: UserTwoEmail,
		GoogleGroups: []service.Group{
			{
				Name:  GroupNameAllUsers,
				Email: GroupEmailAllUsers,
			},
		},
	}
)

Functions

func ContainsCollectionWithName

func ContainsCollectionWithName(collections []*service.MetabaseCollection, expectedName string) bool

func ContainsPermissionGroupWithNamePrefix

func ContainsPermissionGroupWithNamePrefix(permissionGroups []service.MetabasePermissionGroup, prefix string) bool

func ContainsServiceAccount

func ContainsServiceAccount(serviceAccounts map[string]*iam.ServiceAccount, prefix, postfix string) bool

func CreateMultipartFormRequest

func CreateMultipartFormRequest(t *testing.T, method, path string, files map[string]string, objects map[string]string, headers map[string]string) *http.Request

func GetFreePort

func GetFreePort(t *testing.T) int

func Marshal

func Marshal(t *testing.T, v interface{}) []byte

func NewContainers

func NewContainers(t *testing.T, log zerolog.Logger) *containers

func NewDataProductAquacultureFeed

func NewDataProductAquacultureFeed(group string, teamID uuid.UUID) service.NewDataproduct

func NewDataProductBiofuelProduction

func NewDataProductBiofuelProduction(group string, teamID uuid.UUID) service.NewDataproduct

func NewDataProductProtectiveBarriers

func NewDataProductProtectiveBarriers(group string, teamID uuid.UUID) service.NewDataproduct

func NewDataProductReefMonitoring

func NewDataProductReefMonitoring(group string, teamID uuid.UUID) service.NewDataproduct

func NewDatasetBiofuelConsumptionRates

func NewDatasetBiofuelConsumptionRates(dataProductID uuid.UUID) service.NewDataset

func NewDatasetBiofuelConsumptionRatesSchema

func NewDatasetBiofuelConsumptionRatesSchema() []*bigQueryEmulator.Dataset

func NewInsightProductAquacultureFeed

func NewInsightProductAquacultureFeed(group string, teamID uuid.UUID) service.NewInsightProduct

func NewInsightProductBiofuelProduction

func NewInsightProductBiofuelProduction(group string, teamID uuid.UUID) service.NewInsightProduct

func NewInsightProductProtectiveBarriers

func NewInsightProductProtectiveBarriers(group string, teamID uuid.UUID) service.NewInsightProduct

func NewInsightProductReefMonitoring

func NewInsightProductReefMonitoring(group string, teamID uuid.UUID) service.NewInsightProduct

func NewStoryAquacultureFeed

func NewStoryAquacultureFeed(group string) service.NewStory

func NewStoryBiofuelProduction

func NewStoryBiofuelProduction(group string) service.NewStory

func NewStoryProtectiveBarriers

func NewStoryProtectiveBarriers(group string) service.NewStory

func NewStoryReefMonitoring

func NewStoryReefMonitoring(group string) service.NewStory

func NewTester

func NewTester(t *testing.T, s *httptest.Server) *testRunner

func SendRequest

func SendRequest(t *testing.T, method, url string, body io.Reader, headers map[string]string) *http.Response

func StorageCreateInsightProduct

func StorageCreateInsightProduct(t *testing.T, userEmail string, storage service.InsightProductStorage, nip service.NewInsightProduct) *service.InsightProduct

func StorageCreateNaisConsoleTeamsAndProjects

func StorageCreateNaisConsoleTeamsAndProjects(t *testing.T, storage service.NaisConsoleStorage, teams map[string]string)

func StorageCreateProductAreasAndTeams

func StorageCreateProductAreasAndTeams(t *testing.T, storage service.ProductAreaStorage)

func StorageCreateStory

func StorageCreateStory(t *testing.T, storage service.StoryStorage, creator string, ns service.NewStory) *service.Story

func TestRouter

func TestRouter(log zerolog.Logger) chi.Router

func Unmarshal

func Unmarshal(t *testing.T, r io.Reader, v interface{})

Types

type CleanupFn

type CleanupFn func()

type MetabaseConfig

type MetabaseConfig struct {
	FirstName string
	LastName  string
	Email     string
	Password  string
	SiteName  string

	// PremiumEmbeddingToken is populated from the environment.
	PremiumEmbeddingToken string

	// HostPort is populated after the container is started.
	HostPort string
}

func NewMetabaseConfig

func NewMetabaseConfig() *MetabaseConfig

func (*MetabaseConfig) ConnectionURL

func (m *MetabaseConfig) ConnectionURL() string

func (*MetabaseConfig) SessionPropertiesURL

func (m *MetabaseConfig) SessionPropertiesURL() string

func (*MetabaseConfig) SetupBody

func (m *MetabaseConfig) SetupBody(token string) *metabaseSetupBody

func (*MetabaseConfig) SetupURL

func (m *MetabaseConfig) SetupURL() string

type PostgresConfig

type PostgresConfig struct {
	User     string
	Password string
	Database string

	// HostPort is populated after the container is started.
	HostPort string
}

func NewPostgresConfig

func NewPostgresConfig() *PostgresConfig

func (*PostgresConfig) ConnectionURL

func (c *PostgresConfig) ConnectionURL() string

type TestRunner

type TestRunner interface {
	Post(input any, path string, params ...string) TestRunnerStatus
	Get(path string, params ...string) TestRunnerStatus
	Put(input any, path string, params ...string) TestRunnerStatus
	Delete(path string, params ...string) TestRunnerStatus
	Headers(headers map[string]string) TestRunner
	Send(r *http.Request) TestRunnerStatus
}

type TestRunnerEnder

type TestRunnerEnder interface {
	Body() string
	Value(into any)
	Expect(expect, into any, opts ...cmp.Option)
}

type TestRunnerStatus

type TestRunnerStatus interface {
	Debug(out io.Writer) TestRunnerStatus
	HasStatusCode(code int) TestRunnerEnder
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL