tests

package
v0.0.0-...-a7cb739 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tests contains REST API tests for following endpoints:

apiPrefix apiPrefix + "clusters" apiPrefix + "groups" apiPrefix + "organizations"

Package tests contains REST API tests for following endpoints:

apiPrefix + "content"

Package tests contains REST API tests for following endpoints:

apiPrefix apiPrefix + "clusters" apiPrefix + "groups" apiPrefix + "organizations"

Package tests contains REST API tests for following endpoints:

apiPrefix apiPrefix + "clusters" apiPrefix + "groups" apiPrefix + "organizations"

Package tests contains REST API tests for following endpoints:

apiPrefix apiPrefix + "clusters" apiPrefix + "groups" apiPrefix + "organizations"

Package tests contains REST API tests for following endpoints:

apiPrefix apiPrefix + "clusters" apiPrefix + "groups" apiPrefix + "organizations"

Package tests contains REST API tests for following endpoints:

apiPrefix apiPrefix + "clusters" apiPrefix + "groups" apiPrefix + "organizations"

Index

Constants

View Source
const (

	// ContentTypeJSON represents MIME type for JSON format
	ContentTypeJSON = "application/json; charset=utf-8"

	// ContentTypeText represents MIME type for plain text format
	ContentTypeText = "text/plain; charset=utf-8"
)

common constants used by REST API tests

Variables

This section is empty.

Functions

func BasicTests

func BasicTests()

BasicTests implements basic tests for REST API apiPrefix

func ServerTests

func ServerTests()

ServerTests run all tests for basic REST API endpoints

Types

type Ack

type Ack struct {
	Rule          string    `json:"rule"`
	Justification string    `json:"justification"`
	CreatedBy     string    `json:"created_by"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Ack represents one rule Ack

type AckListMetadata

type AckListMetadata struct {
	Count int `json:"count"`
}

AckListMetadata represents metadata about rule acks

type AckListResponse

type AckListResponse struct {
	AckListMetaData AckListMetadata `json:"meta"`
	Acks            []Ack           `json:"data"`
}

AckListResponse represents response containing list of acks

type Alert

type Alert struct {
	Name      string `json:"name"`
	NameSpace string `json:"namespace"`
	Severity  string `json:"severity"`
	URL       string `json:"url"`
}

Alert represents one entry in URP predictions

type AllReportsForOrganizationResponse

type AllReportsForOrganizationResponse struct {
	Clusters    []string    `json:"clusters"`
	Errors      []string    `json:"erors"`
	Reports     interface{} `json:"reports"`
	GeneratedAt time.Time   `json:"generated_at"` // timestamp
}

AllReportsForOrganizationResponse represents response with all reports for given organization

type ClusterEntry

type ClusterEntry struct {
	UUID        string `json:"uuid"`
	DisplayName string `json:"display_name"`
}

ClusterEntry structure represents cluster info in namespaces/dvo payload

type ClusterListInRequest

type ClusterListInRequest struct {
	Clusters []string `json:"clusters"`
}

ClusterListInRequest represents request body containing list of clusters

type ClustersDetails

type ClustersDetails struct {
	MetaData ClustersDetailsMetadata `json:"meta"`
	Clusters []string                `json:"data"`
}

ClustersDetails represents response containing list of clusters for which selected rule was hit

type ClustersDetailsMetadata

type ClustersDetailsMetadata struct {
	Count       int       `json:"count"`
	Component   string    `json:"component"`
	ErrorKey    string    `json:"error_key"`
	GeneratedAt time.Time `json:"generated_at"`
}

ClustersDetailsMetadata represents metadata about number of cluster hits etc.

type ClustersResponse

type ClustersResponse struct {
	Clusters []string `json:"clusters"`
	Status   string   `json:"status"`
}

ClustersResponse represents response containing list of clusters for given organization

type ContentAndGroups

type ContentAndGroups struct {
	Content []string `json:"content"`
	Groups  []Group  `json:"groups"`
	Status  string   `json:"status"`
}

ContentAndGroups represents response from /content endpoint

type DVOWorkloadItem

type DVOWorkloadItem struct {
	Cluster   ClusterEntry   `json:"cluster"`
	Namespace NamespaceEntry `json:"namespace"`
	Reports   []Report       `json:"reports"`
}

DVOWorkloadItem structure represents one entry in list of workloads

type FullReportResponse

type FullReportResponse struct {
	Report types.ReportResponse `json:"report"`
	Status string               `json:"status"`
}

FullReportResponse represents response containing report for given cluster

type Group

type Group struct {
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
}

Group structure represents one group entry in groups array

type GroupsResponse

type GroupsResponse struct {
	Groups []Group `json:"groups"`
	Status string  `json:"status"`
}

GroupsResponse represents response from /organizations endpoint

type Justification

type Justification struct {
	Justification string `json:"justification"`
}

Justification represents structure with justification for acking a rule

type ListOfDVONamespaces

type ListOfDVONamespaces struct {
	Status    string            `json:"status"`
	Workloads []DVOWorkloadItem `json:"workloads"`
}

ListOfDVONamespaces structure represents response for namespaces/dvo REST API endpoint

type MultipleReportsResponse

type MultipleReportsResponse struct {
	Clusters    []string               `json:"clusters"`
	Errors      []string               `json:"errors"`
	Reports     map[string]interface{} `json:"reports"`
	GeneratedAt string                 `json:"generated_at"`
	Status      string                 `json:"status"`
}

MultipleReportsResponse represents response from the server that contains results for multiple clusters together with overall status

type NamespaceEntry

type NamespaceEntry struct {
	UUID string `json:"uuid"`
	Name string `json:"name"`
}

NamespaceEntry structure represents namespace info in namespaces/dvo payload

type OperatorCondition

type OperatorCondition struct {
	Name      string `json:"name"`
	Condition string `json:"condition"`
	Reason    string `json:"reason"`
	URL       string `json:"url"`
}

OperatorCondition represents one entry in URP predictions

type OrganizationsResponse

type OrganizationsResponse struct {
	Organizations []int  `json:"organizations"`
	Status        string `json:"status"`
}

OrganizationsResponse represents response from /organizations endpoint

type Report

type Report struct {
	Check       string `json:"check"`
	Kind        string `json:"kind"`
	Description string `json:"description"`
	Remediation string `json:"remediation"`
}

Report structure represents one report in namespaces/dvo list of reports

type RequestList

type RequestList []string

RequestList represents trivial list of requests to be send to server

type RequestReport

type RequestReport struct {
	Cluster   string      `json:"cluster"`
	RequestID string      `json:"requestID"`
	Status    string      `json:"status"`
	Report    interface{} `json:"report"`
}

RequestReport represents response containing report stored under request ID

{
  "cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a266",
  "requestID": "3oeiljuhkvbi61hf6tpgk4p2xxa",
  "status": "processed",
  "report": null
}

or:

{
  "cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a267",
  "requestID": "3nl2vda87ld6e3s25jlk7n2dna",
  "status": "processed",
  "report": [
    {
      "rule_fqdn": "ccx_rules_ocp.external.rules.nodes_requirements_check.report",
      "error_key": "NODES_MINIMUM_REQUIREMENTS_NOT_MET",
      "description": "Lorem ipsum...",
      "total_risk": 1
    },
    {
      "rule_fqdn": "samples_op_failed_image_import_check.report",
      "error_key": "SAMPLES_FAILED_IMAGE_IMPORT_ERR",
      "description": "Lorem ipsum...",
      "total_risk": 2
    }
  ]
}

type RequestResponse

type RequestResponse struct {
	Cluster  string          `json:"cluster"`
	Requests []RequestStruct `json:"requests"`
	Status   string          `json:"status"`
}

RequestResponse represents response containing list of requests

type RequestStatus

type RequestStatus struct {
	Cluster   string `json:"cluster"`
	RequestID string `json:"requestID"`
	Status    string `json:"status"`
}

RequestStatus represents response containing status of one request. Two states are possible:

{
  "cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a266",
  "requestID": "3oeiljuhkvbi61hf6tpgk4p2sk",
  "status": "processed"
}

and:

{
  "cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a266",
  "requestID": "3oeiljuhkvbi61hf6tpgk4p2sp",
  "status": "unknown"
}

type RequestStruct

type RequestStruct struct {
	RequestID string    `json:"requestID"`
	Valid     bool      `json:"valid"`
	Received  time.Time `json:"received"`
	Processed time.Time `json:"processed"`
}

RequestStruct represents one entry in list of requests

type RuleAckRequest

type RuleAckRequest struct {
	Rule          string `json:"rule_id"`
	Justification string `json:"justification"`
}

RuleAckRequest represents structure used to request rule to be acked via REST API

type StatusOnlyResponse

type StatusOnlyResponse struct {
	Status string `json:"status"`
}

StatusOnlyResponse represents response containing just a status

type URPMetadata

type URPMetadata struct {
	LastCheckedAt time.Time `json:"last_checked_at"`
}

URPMetadata structure represents sub-node in response payload returned from URP endpoint

type URPPredictions

type URPPredictions struct {
	Alerts             []Alert             `json:"alerts"`
	OperatorConditions []OperatorCondition `json:"operator_conditions"`
}

URPPredictions structure represends sub-node in URP recommendation

type URPRecommendations

type URPRecommendations struct {
	UpgradeRecommended     bool           `json:"upgrade_recommended"`
	UpgradeRiskPredictions URPPredictions `json:"upgrade_risks_predictors"`
}

URPRecommendations structure represents sub-node in response payload returned from URP endpoint

type URPResponse

type URPResponse struct {
	Status             string             `json:"status"`
	Meta               URPMetadata        `json:"meta"`
	URPRecommendations URPRecommendations `json:"upgrade_recommendation"`
}

URPResponse structure represents response payload returned from URP endpoint

Jump to

Keyboard shortcuts

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