tests

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// UsersDropTableV1 SQL statement for table drop
	UsersDropTableV1 string = `DROP TABLE IF EXISTS users_v1;`
	// UsersTableV1 SQL statement for the users table
	UsersTableV1 string = `` /* 327-byte string literal not displayed */

	// GroupsDropTableV1 SQL statement for table drop
	GroupsDropTableV1 string = `DROP TABLE IF EXISTS user_groups_v1;`
	// GroupsTableV1 SQL statement for the groups table
	GroupsTableV1 string = `create table IF NOT EXISTS user_groups_v1 (
		id serial primary key not null,
		name varchar(100) not null UNIQUE
	);`

	//UserMembershipsDropTableV1 SQL statement for table drop
	UserMembershipsDropTableV1 string = `DROP TABLE IF EXISTS user_memberships_v1;`
	// UserMembershipsTableV1 SQL statement for the user memberships table
	UserMembershipsTableV1 string = `` /* 196-byte string literal not displayed */

	// RulesDropTableV1 SQL statement for table drop
	RulesDropTableV1 string = `DROP TABLE IF EXISTS rules_v1;`
	// RulesTableV1 SQL statement for the rules table
	RulesTableV1 string = `` /* 219-byte string literal not displayed */

	// RuleVersionsDropTableV1 SQL statement for table drop
	RuleVersionsDropTableV1 string = `DROP TABLE IF EXISTS rule_versions_v1;`
	// RuleVersionsTableV1 SQL statement for the rules table
	RuleVersionsTableV1 string = `` /* 231-byte string literal not displayed */

	//SituationHistoryDropTableV1 SQL statement for table drop
	SituationHistoryDropTableV1 string = `DROP TABLE IF EXISTS situation_history_v1;`
	// SituationHistoryTableV1 SQL statement for the situation history
	SituationHistoryTableV1 string = `` /* 261-byte string literal not displayed */

	//FactHistoryDropTableV1 SQL statement for table drop
	FactHistoryDropTableV1 string = `DROP TABLE IF EXISTS fact_history_v1;`
	// FactHistoryTableV1 SQL statement for the fact history
	FactHistoryTableV1 string = `` /* 250-byte string literal not displayed */

	//FactDefinitionDropTableV1 SQL statement for table drop
	FactDefinitionDropTableV1 string = `DROP TABLE IF EXISTS fact_definition_v1;`
	// FactDefinitionTableV1 SQL statement for the fact definition table
	FactDefinitionTableV1 string = `` /* 156-byte string literal not displayed */

	// SituationDefinitionDropTableV1 SQL statement for table drop
	SituationDefinitionDropTableV1 string = `DROP TABLE IF EXISTS situation_definition_v1;`
	// SituationDefinitionTableV1 SQL statement for the situation definition table
	SituationDefinitionTableV1 string = `` /* 255-byte string literal not displayed */

	// SituationTemplateInstancesDropTableV1 SQL statement to drop table situation_template_instances_v1
	SituationTemplateInstancesDropTableV1 string = `DROP TABLE IF EXISTS situation_template_instances_v1;`
	// SituationTemplateInstancesTableV1 SQL statement to create table situation_template_instances_v1
	SituationTemplateInstancesTableV1 string = `` /* 283-byte string literal not displayed */

	// SituationFactsDropTableV1 SQL statement for table drop
	SituationFactsDropTableV1 string = `DROP TABLE IF EXISTS situation_facts_v1;`
	// SituationFactsTableV1 SQL statement for the situation facts table
	SituationFactsTableV1 string = `` /* 192-byte string literal not displayed */

	// NotificationHistoryDropTableV1 SQL statement for table drop
	NotificationHistoryDropTableV1 string = `DROP TABLE IF EXISTS notifications_history_v1;`
	// NotificationHistoryTableV1 SQL statement for the notification history
	NotificationHistoryTableV1 string = `` /* 185-byte string literal not displayed */

	// JobSchedulesDropTableV1 SQL statement for table drop job schedules
	JobSchedulesDropTableV1 string = `DROP TABLE IF EXISTS job_schedules_v1;`
	// JobSchedulesTableV1 SQL statement for the job schedules
	JobSchedulesTableV1 string = `` /* 221-byte string literal not displayed */

	// IssuesDropTableV1 SQL statement for table drop
	IssuesDropTableV1 string = `DROP TABLE IF EXISTS issues_v1;`
	// IssuesTableV1 SQL statement for the issues table
	IssuesTableV1 string = `` /* 592-byte string literal not displayed */

	// RefRootCauseDropTableV1 SQL statement for table drop
	RefRootCauseDropTableV1 string = `DROP TABLE IF EXISTS ref_rootcause_v1;`
	// RefRootCauseTableV1 SQL statement for the rootcause references
	RefRootCauseTableV1 string = `` /* 295-byte string literal not displayed */

	// RefActionDropTableV1 SQL statement for table drop
	RefActionDropTableV1 string = `DROP TABLE IF EXISTS ref_action_v1;`
	// RefActionTableV1 SQL statement for the action references
	RefActionTableV1 string = `` /* 241-byte string literal not displayed */

	// IssueResolutionDropTableV1 SQL statement for table drop
	IssueResolutionDropTableV1 string = `DROP TABLE IF EXISTS issue_resolution_v1;`
	// IssueResolutionTableV1 SQL statement for the issue resolution statistics
	IssueResolutionTableV1 string = `` /* 303-byte string literal not displayed */

	// IssueResolutionDraftDropTableV1 SQL statement for table drop
	IssueResolutionDraftDropTableV1 string = `DROP TABLE IF EXISTS issue_resolution_draft_v1;`
	// IssueResolutionDraftTableV1 SQL statement for the issue resolution statistics
	IssueResolutionDraftTableV1 string = `` /* 211-byte string literal not displayed */

	// SituationRulesDropTableV1 SQL statement to drop table situation_rules_v1
	SituationRulesDropTableV1 string = `DROP TABLE IF EXISTS situation_rules_v1;`
	// SituationRulesTableV1 SQL statement to create table situation_rules_v1
	SituationRulesTableV1 string = `` /* 209-byte string literal not displayed */

	// ModelDropTableV1 SQL statement to drop table model_v1
	ModelDropTableV1 string = `DROP TABLE IF EXISTS model_v1;`
	// ModelTableV1 SQL statement to create table model_v1
	ModelTableV1 string = `create table IF NOT EXISTS model_v1 (
		id serial primary key,
		name varchar(100) unique not null,
		definition JSONB
	);`

	// EsIndicesDropTableV1 SQL statement to drop table elasticsearch_indices_v1
	EsIndicesDropTableV1 string = `DROP TABLE IF EXISTS elasticsearch_indices_v1;`
	// EsIndicesTableV1 SQL statement to create table elasticsearch_indices_v1
	EsIndicesTableV1 string = `` /* 187-byte string literal not displayed */

	// IssueFeedbackDropTableV3 SQL statement to drop table issue_detection_feedback_v3
	IssueFeedbackDropTableV3 string = `DROP TABLE IF EXISTS issue_detection_feedback_v3;`
	// IssueFeedbackTableV3 SQL statement to create table issue_detection_feedback_v3
	IssueFeedbackTableV3 string = `` /* 282-byte string literal not displayed */

	// CalendarDropTableV3 SQL statement to drop table calendar_v1
	CalendarDropTableV3 string = `DROP TABLE IF EXISTS calendar_V1;`
	// CalendarTableV3 SQL statement to create table calendar_v1
	CalendarTableV3 string = `` /* 312-byte string literal not displayed */

	// CalendarUnionDropTableV3 SQL statement to drop table calendar_union_v1
	CalendarUnionDropTableV3 string = `DROP TABLE IF EXISTS calendar_union_v1;`
	// CalendarUnionTableV3 SQL statement to create table calendar_union_v1
	CalendarUnionTableV3 string = `` /* 206-byte string literal not displayed */

	//ConnectorExecutionsLogsDropTableV1 SQL statement to drop table connectors_executions_log_v1
	ConnectorExecutionsLogsDropTableV1 string = `DROP TABLE IF EXISTS connectors_executions_log_v1;`
	//ConnectorExecutionsLogsTableV1 SQL statement to create table connectors_executions_log_v1
	ConnectorExecutionsLogsTableV1 string = `` /* 194-byte string literal not displayed */

	UsersDropTableV4   string = `drop table if exists users_v4;`
	UsersCreateTableV4 string = `` /* 286-byte string literal not displayed */

	RolesDropTableV4   string = `drop table if exists roles_v4;`
	RolesCreateTableV4 string = `create table roles_v4 (
		id uuid primary key,
		name varchar(100) not null UNIQUE
	);`

	PermissionsDropTableV4   string = `drop table if exists permissions_v4;`
	PermissionsCreateTableV4 string = `` /* 163-byte string literal not displayed */

	UsersRolesDropTableV4   string = `drop table if exists users_roles_v4;`
	UsersRolesCreateTableV4 string = `create table users_roles_v4 (
		user_id uuid REFERENCES users_v4 (id),
		role_id uuid REFERENCES roles_v4 (id)
	);`

	RolesPermissionsDropTableV4   string = `drop table if exists roles_permissions_v4;`
	RolesPermissionsCreateTableV4 string = `` /* 132-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func BuildTestHandler

func BuildTestHandler(t *testing.T, method string, targetRoute string, body string, handlerRoute string, handler http.HandlerFunc, user interface{}) *httptest.ResponseRecorder

BuildTestHandler build and call a testing handler and returns the resulting ResponseRecorder for validation

func CheckDebugLogs

func CheckDebugLogs(t *testing.T)

CheckDebugLogs checks for the "debug" flags while starting a test and enable zap logging

func CheckTestHandler

func CheckTestHandler(t *testing.T, rr *httptest.ResponseRecorder, expectedStatus int, expectedBody string)

CheckTestHandler checks a ResponseRecorder HTTP status and body

func DBClient

func DBClient(t *testing.T) *sqlx.DB

DBClient returns a postgresql test client for integration tests It targets a specific hostname "postgres" in a Gitlab CI environnement or "localhost" by default

func DBExec

func DBExec(dbClient *sqlx.DB, query string, t *testing.T, failNow bool)

DBExec execute an sql query which can lead to an immediate failure of the unit test

Types

This section is empty.

Jump to

Keyboard shortcuts

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