integrationutils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PKIUAAConfigPath             = "../../env/secret/cert-issuer-plugins/uaa.json"
	PKIServiceConfigPath         = "../../env/secret/cert-issuer-plugins/service.json"
	NotificationUAAConfigPath    = "../../env/secret/notification-plugins/uaa.json"
	NotificationEndpointsPath    = "../../env/secret/notification-plugins/endpoints.json"
	IdentityManagementConfigPath = "../../env/secret/identity-management/scim.json"
)

Variables

View Source
var DB = config.Database{
	Host: commoncfg.SourceRef{
		Source: commoncfg.EmbeddedSourceValue,
		Value:  "localhost",
	},
	User: commoncfg.SourceRef{
		Source: commoncfg.EmbeddedSourceValue,
		Value:  "admin",
	},
	Secret: commoncfg.SourceRef{
		Source: commoncfg.EmbeddedSourceValue,
		Value:  "password",
	},
	Name: "mydb",
	Port: "5432",
}
View Source
var IDManagementPath = func() string {
	_, filename, _, _ := runtime.Caller(0)
	baseDir := filepath.Dir(filename)
	return filepath.Join(baseDir, "../../identity-management-plugins/bin/scim")
}
View Source
var IDManagementYaml = func(t *testing.T) string {
	t.Helper()

	type Params struct {
		GroupAttribute          commoncfg.SourceRef `yaml:"groupAttribute"`
		UserAttribute           commoncfg.SourceRef `yaml:"userAttribute"`
		GroupMembersAttribute   commoncfg.SourceRef `yaml:"groupMembersAttribute"`
		ListMethod              commoncfg.SourceRef `yaml:"listMethod"`
		AllowSearchUsersByGroup commoncfg.SourceRef `yaml:"allowSearchUsersByGroup"`
	}

	cfg := struct {
		Host   commoncfg.SourceRef `yaml:"host"`
		Auth   commoncfg.SecretRef `yaml:"auth"`
		Params Params              `yaml:"params"`
	}{
		Host: commoncfg.SourceRef{
			Source: commoncfg.FileSourceValue,
			File: commoncfg.CredentialFile{
				Path:     IdentityManagementConfigPath,
				Format:   commoncfg.JSONFileFormat,
				JSONPath: "$['host']",
			},
		},
		Auth: commoncfg.SecretRef{
			Type: commoncfg.MTLSSecretType,
			MTLS: commoncfg.MTLS{
				Cert: commoncfg.SourceRef{
					Source: commoncfg.FileSourceValue,
					File: commoncfg.CredentialFile{
						Path:     IdentityManagementConfigPath,
						Format:   commoncfg.JSONFileFormat,
						JSONPath: "$['auth']['cert']",
					},
				},
				CertKey: commoncfg.SourceRef{
					Source: commoncfg.FileSourceValue,
					File: commoncfg.CredentialFile{
						Path:     IdentityManagementConfigPath,
						Format:   commoncfg.JSONFileFormat,
						JSONPath: "$['auth']['certKey']",
					},
				},
			},
		},
		Params: Params{
			GroupAttribute: commoncfg.SourceRef{
				Source: commoncfg.FileSourceValue,
				File: commoncfg.CredentialFile{
					Path:     IdentityManagementConfigPath,
					Format:   commoncfg.JSONFileFormat,
					JSONPath: "$['params']['groupAttribute']",
				},
			},
			UserAttribute: commoncfg.SourceRef{
				Source: commoncfg.FileSourceValue,
				File: commoncfg.CredentialFile{
					Path:     IdentityManagementConfigPath,
					Format:   commoncfg.JSONFileFormat,
					JSONPath: "$['params']['userAttribute']",
				},
			},
			GroupMembersAttribute: commoncfg.SourceRef{
				Source: commoncfg.FileSourceValue,
				File: commoncfg.CredentialFile{
					Path:     IdentityManagementConfigPath,
					Format:   commoncfg.JSONFileFormat,
					JSONPath: "$['params']['groupMembersAttribute']",
				},
			},
			ListMethod: commoncfg.SourceRef{
				Source: commoncfg.FileSourceValue,
				File: commoncfg.CredentialFile{
					Path:     IdentityManagementConfigPath,
					Format:   commoncfg.JSONFileFormat,
					JSONPath: "$['params']['listMethod']",
				},
			},
			AllowSearchUsersByGroup: commoncfg.SourceRef{
				Source: commoncfg.FileSourceValue,
				File: commoncfg.CredentialFile{
					Path:     IdentityManagementConfigPath,
					Format:   commoncfg.JSONFileFormat,
					JSONPath: "$['params']['allowSearchUsersByGroup']",
				},
			},
		},
	}

	bytes, _ := yaml.Marshal(cfg)

	return string(bytes)
}
View Source
var IDMangementPlugin = func(t *testing.T) plugincatalog.PluginConfig {
	t.Helper()

	return plugincatalog.PluginConfig{
		Name:              "IDENTITY_MANAGEMENT",
		Type:              idmangv1.Type,
		Path:              IDManagementPath(),
		LogLevel:          "debug",
		YamlConfiguration: IDManagementYaml(t),
	}
}
View Source
var KeystorePlugin = func(t *testing.T) plugincatalog.PluginConfig {
	t.Helper()

	return plugincatalog.PluginConfig{
		Name:     "AWS",
		Type:     keystoreopv1.Type,
		LogLevel: "debug",
		Path:     keystorePath(),
		Tags: []string{
			"default_keystore",
		},
	}
}
View Source
var KeystoreProviderPlugin = func(t *testing.T) plugincatalog.PluginConfig {
	t.Helper()

	return plugincatalog.PluginConfig{
		Name:     "AWS",
		Type:     keystoremanv1.Type,
		Path:     keystoreProviderPath(),
		LogLevel: "debug",
	}
}
View Source
var MessageService = config.Redis{
	Host: commoncfg.SourceRef{
		Source: commoncfg.EmbeddedSourceValue,
		Value:  "localhost",
	},
	ACL: config.RedisACL{
		Enabled: true,
		Password: commoncfg.SourceRef{
			Source: commoncfg.EmbeddedSourceValue,
			Value:  "secret",
		},
		Username: commoncfg.SourceRef{
			Source: commoncfg.EmbeddedSourceValue,
			Value:  "default",
		},
	},
	Port: "6379",
	SecretRef: commoncfg.SecretRef{
		Type: commoncfg.InsecureSecretType,
	},
}
View Source
var NotificationPlugin = func(t *testing.T) plugincatalog.PluginConfig {
	t.Helper()

	return plugincatalog.PluginConfig{
		Name:              "NOTIFICATION",
		Type:              notificationv1.Type,
		LogLevel:          "debug",
		YamlConfiguration: notificationYaml(t),
		Path:              notificationPath(),
	}
}
View Source
var PKIPlugin = func(t *testing.T) plugincatalog.PluginConfig {
	t.Helper()

	return plugincatalog.PluginConfig{
		Name:              "CERT_ISSUER",
		Type:              certificate_issuerv1.Type,
		LogLevel:          "debug",
		YamlConfiguration: pkiYaml(t),
		Path:              pkiPath(),
	}
}
View Source
var ReplicaDB = []config.Database{
	{
		Host: commoncfg.SourceRef{
			Source: commoncfg.EmbeddedSourceValue,
			Value:  "localhost",
		},
		User: commoncfg.SourceRef{
			Source: commoncfg.EmbeddedSourceValue,
			Value:  "admin",
		},
		Secret: commoncfg.SourceRef{
			Source: commoncfg.EmbeddedSourceValue,
			Value:  "password",
		},
		Name: "mydb",
		Port: "5433",
	},
}
View Source
var SISPlugin = func(t *testing.T) plugincatalog.PluginConfig {
	t.Helper()

	return plugincatalog.PluginConfig{
		Name:              "SYSINFO",
		Type:              systeminformationv1.Type,
		Path:              sisPath(),
		LogLevel:          "debug",
		YamlConfiguration: sisYaml(t),
	}
}

Functions

func CheckAllPluginsMissingFiles

func CheckAllPluginsMissingFiles(t *testing.T) bool

func CheckRegion

func CheckRegion(ctx context.Context, t *testing.T, database *multitenancy.DB, tenantID string, expectedRegion string)

func GroupsExists

func GroupsExists(ctx context.Context, t require.TestingT, tenantID string, multitenancydb *multitenancy.DB)

func MissingFiles

func MissingFiles(t *testing.T, requiredFiles []string) bool

func NamespaceExists

func NamespaceExists(database *multitenancy.DB, tenantName string) (bool, error)

func TableInTenantSchemaExist

func TableInTenantSchemaExist(database *multitenancy.DB, tenantName string,
	tableName string,
) (bool, error)

func TenantExists

func TenantExists(t require.TestingT, multitenancydb *multitenancy.DB, schemaName, tableName string)

func TenantExistsInPublicSchema

func TenantExistsInPublicSchema(database *multitenancy.DB, tenantName string) (bool, error)

func TenantSchemaExists

func TenantSchemaExists(database *multitenancy.DB, tenantName string) (bool, error)

Types

type TableInfo

type TableInfo struct {
	Schema string `gorm:"column:table_schema"`
	Name   string `gorm:"column:table_name"`
}

func (TableInfo) TableName

func (TableInfo) TableName() string

Jump to

Keyboard shortcuts

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