{"modulePath":"github.com/goplugin/plugin-testing-framework","version":"v0.0.0-20241030122847-171e6b0a8043","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\n## Constants\n\n```go\nconst (\n\tQueryMemoryUsage          = `100 * (1 - ((avg_over_time(node_memory_MemFree_bytes[%s]) + avg_over_time(node_memory_Cached_bytes[%s]) + avg_over_time(node_memory_Buffers_bytes[%s])) / avg_over_time(node_memory_MemTotal_bytes[%s])))`\n\tQueryAllCPUBusyPercentage = `100 - (avg by (instance) (irate(node_cpu_seconds_total{mode=\"idle\"}[%s])) * 100)`\n)\n```\nQuery constants\n\n```go\nconst WITHOUT_TOKEN = \"\"\n```\n\n## Types\n\n```go\ntype AdapterResponse struct {\n\tId    string        `json:\"id\"`\n\tData  AdapterResult `json:\"data\"`\n\tError interface{}   `json:\"error\"`\n}\n```\nAdapterResponse represents a response from an adapter\n\n```go\ntype AdapterResult struct {\n\tResult interface{} `json:\"result\"`\n}\n```\nAdapterResult represents an int result for an adapter\n\n```go\ntype AnvilContainer struct {\n\ttestcontainers.Container\n\tURL string\n}\n```\n\n```go\nfunc StartAnvil(params []string) (*AnvilContainer, error)\n```\n\n```go\ntype ContractInfoJSON struct {\n\tContractAddress string `json:\"contractAddress\"`\n\tContractVersion int    `json:\"contractVersion\"`\n\tPath            string `json:\"path\"`\n\tStatus          string `json:\"status\"`\n}\n```\nContractInfoJSON represents an element of the contracts array used to deliver configs to otpe\n\n```go\ntype CurrentBlockResponse struct {\n\tResult string `json:\"result\"`\n}\n```\n\n```go\ntype ExplorerClient struct {\n\tAPIClient *resty.Client\n\tConfig    *ExplorerConfig\n}\n```\nExplorerClient is used to call Explorer API endpoints\n\n```go\nfunc NewExplorerClient(cfg *ExplorerConfig) *ExplorerClient\n```\nNewExplorerClient creates a new explorer mock client\n\n```go\nfunc (em *ExplorerClient) PostAdminNodes(nodeName string) (NodeAccessKeys, error)\n```\nPostAdminNodes is used to exercise the POST /api/v1/admin/nodes endpoint This endpoint is used to create access keys for nodes\n\n```go\ntype ExplorerConfig struct {\n\tURL           string\n\tAdminUsername string\n\tAdminPassword string\n}\n```\nExplorerConfig holds config information for ExplorerClient\n\n```go\ntype GethContainer struct {\n\ttestcontainers.Container\n\tURL string\n}\n```\n\n```go\ntype GithubClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewGithubClient(token string) *GithubClient\n```\n\n```go\nfunc (g *GithubClient) ListLatestCLCoreReleases(count int) ([]*github.RepositoryRelease, error)\n```\nListLatestCLCoreReleases lists the latest releases for the Plugin core repository\n\n```go\nfunc (g *GithubClient) ListLatestCLCoreTags(count int) ([]*github.RepositoryTag, error)\n```\nListLatestCLCoreTags lists the latest tags for the Plugin core repository\n\n```go\nfunc (g *GithubClient) ListLatestReleases(org, repository string, count int) ([]*github.RepositoryRelease, error)\n```\nListLatestReleases lists the latest releases for a given repository\n\n```go\ntype HttpInitializer struct {\n\tId       string       `json:\"id\"`\n\tRequest  HttpRequest  `json:\"httpRequest\"`\n\tResponse HttpResponse `json:\"httpResponse\"`\n}\n```\nHttpInitializer represents an element of the initializer array used in the mockserver initializer\n\n```go\ntype HttpInitializerTemplate struct {\n\tId       string               `json:\"id\"`\n\tRequest  HttpRequest          `json:\"httpRequest\"`\n\tResponse HttpResponseTemplate `json:\"httpResponseTemplate\"`\n}\n```\nHttpInitializer represents an element of the initializer array used in the mockserver initializer\n\n```go\ntype HttpRequest struct {\n\tPath string `json:\"path\"`\n}\n```\nHttpRequest represents the httpRequest json object used in the mockserver initializer\n\n```go\ntype HttpResponse struct {\n\tBody interface{} `json:\"body\"`\n}\n```\nHttpResponse represents the httpResponse json object used in the mockserver initializer\n\n```go\ntype HttpResponseTemplate struct {\n\tTemplate     string `json:\"template\"`\n\tTemplateType string `json:\"templateType\"`\n}\n```\nHttpResponse represents the httpResponse json object used in the mockserver initializer\n\n```go\ntype KafkaRestClient struct {\n\tAPIClient *resty.Client\n\tConfig    *KafkaRestConfig\n}\n```\nKafkaRestClient kafka-rest client\n\n```go\nfunc NewKafkaRestClient(cfg *KafkaRestConfig) *KafkaRestClient\n```\nNewKafkaRestClient creates a new KafkaRestClient\n\n```go\nfunc (krc *KafkaRestClient) GetTopics() ([]string, error)\n```\nGetTopics Get a list of Kafka topics.\n\n```go\ntype KafkaRestConfig struct {\n\tURL string\n}\n```\nKafkaRestConfig holds config information for KafkaRestClient\n\n```go\ntype MockserverClient struct {\n\tAPIClient *resty.Client\n\tConfig    *MockserverConfig\n}\n```\nMockserverClient mockserver client\n\n```go\nfunc ConnectMockServer(e *environment.Environment) (*MockserverClient, error)\n```\nConnectMockServer creates a connection to a deployed mockserver in the environment\n\n```go\nfunc ConnectMockServerURL(url string) (*MockserverClient, error)\n```\nConnectMockServerURL creates a connection to a mockserver at a given url, should only be used for inside K8s tests\n\n```go\nfunc NewMockserverClient(cfg *MockserverConfig) *MockserverClient\n```\nNewMockserverClient returns a mockserver client\n\n```go\nfunc (em *MockserverClient) ClearExpectation(body interface{}) error\n```\nClearExpectation clears expectations\n\n```go\nfunc (em *MockserverClient) LocalURL() string\n```\nLocalURL returns the local url of the mockserver\n\n```go\nfunc (em *MockserverClient) PutExpectations(body interface{}) error\n```\nPutExpectations sets the expectations (i.e. mocked responses)\n\n```go\nfunc (em *MockserverClient) SetAnyValuePath(path string, v interface{}) error\n```\nSetAnyValuePath sets any type of value for a path\n\n```go\nfunc (em *MockserverClient) SetAnyValueResponse(path string, v interface{}) error\n```\n\n```go\nfunc (em *MockserverClient) SetRandomValuePath(path string) error\n```\nSetRandomValuePath sets a random int value for a path\n\n```go\nfunc (em *MockserverClient) SetStringValuePath(path string, stringValue string) error\n```\nSetStringValuePath sets a string value for a path and returns it as a raw string\n\n```go\nfunc (em *MockserverClient) SetValuePath(path string, v int) error\n```\nSetValuePath sets an int for a path\n\n```go\ntype MockserverConfig struct {\n\tLocalURL   string\n\tClusterURL string\n}\n```\nMockserverConfig holds config information for MockserverClient\n\n```go\ntype Name struct {\n\tName string `json:\"name\"`\n}\n```\nName is the body of the request\n\n```go\ntype NodeAccessKeys struct {\n\tID        string `json:\"id\"`\n\tAccessKey string `json:\"accessKey\"`\n\tSecret    string `json:\"secret\"`\n}\n```\nNodeAccessKeys is the body of the response\n\n```go\ntype NodeInfoJSON struct {\n\tID          string   `json:\"id\"`\n\tNodeAddress []string `json:\"nodeAddress\"`\n}\n```\nNodeInfoJSON represents an element of the nodes array used to deliver configs to otpe\n\n```go\ntype PathSelector struct {\n\tPath string `json:\"path\"`\n}\n```\nPathSelector represents the json object used to find expectations by path\n\n```go\ntype PostgresConfig struct {\n\tHost     string\n\tPort     string\n\tUser     string\n\tPassword string\n\tDBName   string\n\tSSLMode  string\n}\n```\nPostgresConfig postgres config for connection string\n\n```go\ntype PostgresConnector struct {\n\t*sqlx.DB\n\tCfg *PostgresConfig\n}\n```\nPostgresConnector sqlx postgres connector\n\n```go\nfunc ConnectDB(nodeNum int, e *environment.Environment) (*PostgresConnector, error)\n```\n\n```go\nfunc NewPostgresConnector(cfg *PostgresConfig) (*PostgresConnector, error)\n```\nNewPostgresConnector creates new sqlx postgres connector\n\n```go\ntype Prometheus struct {\n\tv1.API\n}\n```\nPrometheus ease of use for v1.API\n\n```go\nfunc NewPrometheusClient(url string) (*Prometheus, error)\n```\nNewPrometheusClient returns a prometheus client\n\n```go\nfunc (p *Prometheus) CPUBusyPercentage() (float64, error)\n```\nCPUBusyPercentage host CPU busy percentage\n\n```go\nfunc (p *Prometheus) GetAlerts() (v1.AlertsResult, error)\n```\nGetAlerts returns all firing alerts\n\n```go\nfunc (p *Prometheus) GetQuery(query string) (model.Value, error)\n```\nGetQuery returns the result of applying a PromQL query\n\n```go\nfunc (p *Prometheus) MemoryUsage() (float64, error)\n```\nMemoryUsage total memory used by interval\n\n```go\nfunc (p *Prometheus) ResourcesSummary() (float64, float64, error)\n```\nResourcesSummary returns a summary of memory and cpu used\n\n```go\ntype RPCClient struct {\n\tURL string\n\t// contains filtered or unexported fields\n}\n```\nRPCClient is an RPC client for various node simulators API Reference [https://book.getfoundry.sh/reference/anvil/](https://book.getfoundry.sh/reference/anvil/)\n\n```go\nfunc NewRPCClient(url string) *RPCClient\n```\nNewRPCClient creates Anvil client\n\n```go\nfunc (m *RPCClient) AnvilDropTransaction(params []interface{}) error\n```\nAnvilDropTransaction removes transaction from tx pool API Reference [https://book.getfoundry.sh/reference/anvil/](https://book.getfoundry.sh/reference/anvil/)\n\n```go\nfunc (m *RPCClient) AnvilMine(params []interface{}) error\n```\nAnvilMine calls \"evm\\_mine\", mines one or more blocks, see the reference on RPCClient API Reference [https://book.getfoundry.sh/reference/anvil/](https://book.getfoundry.sh/reference/anvil/)\n\n```go\nfunc (m *RPCClient) AnvilSetAutoMine(flag bool) error\n```\nAnvilSetAutoMine calls \"evm\\_setAutomine\", turns automatic mining on, see the reference on RPCClient API Reference [https://book.getfoundry.sh/reference/anvil/](https://book.getfoundry.sh/reference/anvil/)\n\n```go\nfunc (m *RPCClient) AnvilSetBlockGasLimit(params []interface{}) error\n```\nAnvilSetBlockGasLimit sets next block gas limit API Reference [https://book.getfoundry.sh/reference/anvil/](https://book.getfoundry.sh/reference/anvil/)\n\n```go\nfunc (m *RPCClient) AnvilSetMinGasPrice(params []interface{}) error\n```\nAnvilSetMinGasPrice sets min gas price (pre-EIP-1559 anvil is required) API Reference [https://book.getfoundry.sh/reference/anvil/](https://book.getfoundry.sh/reference/anvil/)\n\n```go\nfunc (m *RPCClient) AnvilSetNextBlockBaseFeePerGas(params []interface{}) error\n```\nAnvilSetNextBlockBaseFeePerGas sets next block base fee per gas value API Reference [https://book.getfoundry.sh/reference/anvil/](https://book.getfoundry.sh/reference/anvil/)\n\n```go\nfunc (m *RPCClient) AnvilTxPoolStatus(params []interface{}) (*TxStatusResponse, error)\n```\nAnvilTxPoolStatus calls \"txpool\\_status\", returns txpool status, see the reference on RPCClient API Reference [https://book.getfoundry.sh/reference/anvil/](https://book.getfoundry.sh/reference/anvil/)\n\n```go\nfunc (m *RPCClient) BlockNumber() (int64, error)\n```\nCall \"eth\\_blockNumber\" to get the current block number\n\n```go\nfunc (m *RPCClient) GethSetHead(blocksBack int) error\n```\n\n```go\nfunc (m *RPCClient) ModulateBaseFeeOverDuration(lggr zerolog.Logger, startingBaseFee int64, percentage float64, duration time.Duration, spike bool) error\n```\nModulateBaseFeeOverDuration will cause the gas price to rise or drop to a certain percentage of the starting gas price over the duration specified. Minimum duration is 1 s if spike is true, the gas price will rise to the target price if spike is false, the gas price will drop to the target price\n\n```go\ntype RemoteAnvilMiner struct {\n\tClient *RPCClient\n\t// contains filtered or unexported fields\n}\n```\nRemoteAnvilMiner is a remote miner for Anvil node Allows to control blocks emission more precisely to mimic real networks workload\n\n```go\nfunc NewRemoteAnvilMiner(url string) *RemoteAnvilMiner\n```\nNewRemoteAnvilMiner creates a new remote miner client\n\n```go\nfunc (m *RemoteAnvilMiner) MineBatch(capacity int64, checkInterval time.Duration, sendInterval time.Duration)\n```\nMineBatch checks the pending transactions in the pool, if threshold is reached mines the block and repeat the process\n\n```go\nfunc (m *RemoteAnvilMiner) MinePeriodically(interval time.Duration)\n```\nMinePeriodically mines blocks with a specified interval should be used when Anvil mining is off\n\n```go\nfunc (m *RemoteAnvilMiner) Stop()\n```\nStop stops the miner\n\n```go\ntype ResourcesSummary struct {\n\tMemoryUsage   float64\n\tCPUPercentage float64\n}\n```\nResourcesSummary Data for memory and cpu usage\n\n```go\ntype TxStatusResponse struct {\n\tResult struct {\n\t\tPending string `json:\"pending\"`\n\t} `json:\"result\"`\n}\n```\nTxStatusResponse common RPC response body\n\n","path":"github.com/goplugin/plugin-testing-framework/client","name":"client","synopsis":"","isRedistributable":true}
