signoz_cloud_integrations_test.go
Overview - signoz_cloud_integrations_test.go
This file contains integration tests for the cloud integrations feature in SigNoz, specifically focusing on AWS integration. It tests the lifecycle of AWS integration accounts, including connecting, managing, and disconnecting them, as well as configuring cloud services within the context of a connected account.
Detailed Documentation
TestAWSIntegrationAccountLifecycle
- Purpose: Tests the happy path of connecting and managing AWS integration accounts.
- Parameters:
t
(*testing.T): Testing object.
- Returns: None
TestAWSIntegrationServices
- Purpose: Tests the retrieval and configuration of AWS integration services.
- Parameters:
t
(*testing.T): Testing object.
- Returns: None
TestConfigReturnedWhenAgentChecksIn
- Purpose: Tests that the correct integration configuration is returned when an agent checks in with the query service.
- Parameters:
t
(*testing.T): Testing object.
- Returns: None
CloudIntegrationsTestBed
- Purpose: Struct that sets up and manages the test environment for cloud integrations.
- Parameters:
t
(*testing.T): Testing object.testUser
(*types.User): Test user.qsHttpHandler
(http.Handler): HTTP handler for the query service.mockClickhouse
(mockhouse.ClickConnMockCommon): Mock ClickHouse connection.
- Returns: None
NewCloudIntegrationsTestBed
- Purpose: Creates a new instance of
CloudIntegrationsTestBed
. - Parameters:
t
(*testing.T): Testing object.testDB
(sqlstore.SQLStore): Optional SQL store for testing; if nil, a new one is created.
- Returns:
*CloudIntegrationsTestBed
: A pointer to the newly createdCloudIntegrationsTestBed
instance.
GetConnectedAccountsListFromQS
- Purpose: Retrieves the list of connected accounts for a specific cloud provider from the query service.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").
- Returns:
*cloudintegrations.ConnectedAccountsListResponse
: A pointer to the response containing the list of connected accounts.
GenerateConnectionUrlFromQS
- Purpose: Generates a connection URL for a given cloud provider from the query service.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").req
(cloudintegrations.GenerateConnectionUrlRequest): The request containing agent and account configuration.
- Returns:
*cloudintegrations.GenerateConnectionUrlResponse
: A pointer to the response containing the connection URL and account ID.
GetAccountStatusFromQS
- Purpose: Retrieves the status of a specific account for a given cloud provider from the query service.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").accountId
(string): The ID of the account to retrieve the status for.
- Returns:
*cloudintegrations.AccountStatusResponse
: A pointer to the response containing the account status.
CheckInAsAgentWithQS
- Purpose: Simulates an agent checking in with the query service for a specific cloud provider.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").req
(cloudintegrations.AgentCheckInRequest): The request containing account and cloud account information.
- Returns:
*cloudintegrations.AgentCheckInResponse
: A pointer to the response containing the agent check-in information.
UpdateAccountConfigWithQS
- Purpose: Updates the configuration of a specific account for a given cloud provider using the query service.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").accountId
(string): The ID of the account to update.newConfig
(cloudintegrations.AccountConfig): The new account configuration.
- Returns:
*cloudintegrations.AccountRecord
: A pointer to the response containing the updated account record.
DisconnectAccountWithQS
- Purpose: Disconnects/removes a specific account for a given cloud provider using the query service.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").accountId
(string): The ID of the account to disconnect.
- Returns:
*cloudintegrations.AccountRecord
: A pointer to the response containing the disconnected account record.
GetServicesFromQS
- Purpose: Retrieves a list of available cloud services for a given cloud provider from the query service.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").cloudAccountId
(*string): Optional pointer to a string containing the cloud account ID to filter services by.
- Returns:
*cloudintegrations.ListServicesResponse
: A pointer to the response containing the list of services.
GetServiceDetailFromQS
- Purpose: Retrieves detailed information about a specific cloud service for a given cloud provider from the query service.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").serviceId
(string): The ID of the service to retrieve details for.cloudAccountId
(*string): Optional pointer to a string containing the cloud account ID to retrieve details in the context of.
- Returns:
*cloudintegrations.CloudServiceDetails
: A pointer to the response containing the service details.
UpdateServiceConfigWithQS
- Purpose: Updates the configuration of a specific cloud service for a given cloud provider using the query service.
- Parameters:
cloudProvider
(string): The cloud provider (e.g., "aws").serviceId
(string): The ID of the service to update.req
(any): The request containing the updated service configuration.
- Returns:
*cloudintegrations.UpdateServiceConfigResponse
: A pointer to the response containing the updated service configuration.
RequestQS
- Purpose: Makes a request to the query service with authentication.
- Parameters:
path
(string): The path to request.postData
(interface{}): The data to post (if any).
- Returns:
responseDataJson
([]byte): The JSON response from the query service.
RequestQSAndParseResp
- Purpose: Makes a request to the query service and parses the JSON response.
- Parameters:
tb
(*CloudIntegrationsTestBed): The testbed instance.path
(string): The path to request.postData
(interface{}): The data to post (if any).
- Returns:
*ResponseType
: A pointer to the parsed response object.
Code Examples
// Example of creating a CloudIntegrationsTestBed instance
const testbed = NewCloudIntegrationsTestBed(t, null);
// Example of getting connected accounts list
const accountsList = testbed.GetConnectedAccountsListFromQS("aws");
Include in Getting Started: NO