client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestManager     = "TEST_E2E_MANAGER"
	TestAgent       = "TEST_E2E_AGENT"
	TestAlertsTable = "alerts.status"
)
View Source
const TestEnvPrefix = "TEST_E2E"

Variables

View Source
var (
	TestConfig = config.Config{
		LogLevel: "ERROR",
		HTTPServer: config.HTTPServerConfig{
			Listen: func() string {
				listen := "localhost"
				if addr := os.Getenv(TestEnvPrefix + "_LISTEN_HOST"); addr != "" {
					listen = addr
				}
				if port := os.Getenv(TestEnvPrefix + "_LISTEN_PORT"); port != "" {
					return listen + ":" + port
				}
				return listen
			}(),
		},
		OMNIbus: config.OMNIbus{
			Clusters: func() map[string]config.SeedList {
				res := make(map[string]config.SeedList)
				for i, addr := range strings.Split(os.Getenv(TestEnvPrefix+"_ADDRESS"), ",") {
					res[fmt.Sprintf("OMNI_%d", i)] = config.SeedList{addr}
				}
				return res
			}(),
			ConnectionLabel: "TEST_E2E_QOORDINATOR",
			MaxConnections:  10,
			RandomFailOver:  true,
		},
	}

	TestUser     = os.Getenv(TestEnvPrefix + "_USER")
	TestPassword = os.Getenv(TestEnvPrefix + "_PASSWORD")

	NcoSql = func() goqu.DialectWrapper {
		opts := goqu.DefaultDialectOptions()
		opts.QuoteRune = rune(32)
		opts.SupportsConflictTarget = false
		opts.SupportsWithCTE = false
		goqu.RegisterDialect("netcool", opts)
		return goqu.Dialect("netcool")
	}()
)

Functions

func DoBenchmarkInsert

func DoBenchmarkInsert(b *testing.B, client Client, rowCount int, concurrency int)

func DoBenchmarkSelect

func DoBenchmarkSelect(b *testing.B, client Client, rowCount, selCount int, concurrency int)

func DoTestCRUD

func DoTestCRUD(t *testing.T, client Client)

func SentenceFactory

func SentenceFactory() string

Types

type AlertStatusRecord

type AlertStatusRecord struct {
	Identifier      string `faker:"uuid_hyphenated" db:"Identifier"`
	Node            string `faker:"domain_name" db:"Node"`
	NodeAlias       string `faker:"ipv4" db:"NodeAlias"`
	Agent           string `faker:"-" db:"Agent"`
	Manager         string `faker:"-" db:"Manager"`
	AlertGroup      string `faker:"-" db:"AlertGroup"`
	AlertKey        string `faker:"uuid_digit" db:"AlertKey"`
	Type            uint8  `faker:"oneof: 1" db:"Type"`
	Severity        uint8  `faker:"oneof: 2, 3, 4, 5" db:"Severity"`
	Summary         string `faker:"sentence" db:"Summary"`
	FirstOccurrence int64  `faker:"unix_time" db:"FirstOccurrence"`
	URL             string `faker:"url" db:"URL"`
	ExtendedAttr    string `faker:"paragraph" db:"ExtendedAttr"`
}

func AlertStatusRecordFactory

func AlertStatusRecordFactory() AlertStatusRecord

func NewAlertStatusRecordFromMap

func NewAlertStatusRecordFromMap(params map[string]any) AlertStatusRecord

type Client

type Client interface {
	RawSQLPost(ctx context.Context, query models.Query, credentials models.Credentials) (map[string]QueryResult, error)
}

type QueryResult

type QueryResult struct {
	RowSet       []map[string]any
	AffectedRows int
	Error        error
}

Jump to

Keyboard shortcuts

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