tools

package
v0.0.0-...-7cc1d6a Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

README

Tools

Tools package is intended to contain types and public helper methods that provide utilities to solves common requirements across repos. It currently contains following helper methods:

  1. GetDefaultKubePath: Helper method to retrieve the path for Kubeconfig inside users home directory.
  2. GetWebhookServiceIP: Helper method to retrieve the public IP address for the webhook service. The service is setup as part of the apicoverage-webhook setup.
  3. GetResourceCoverage: Helper method to retrieve Coverage data for a resource passed as parameter. The coverage data is retrieved from the API that is exposed by the HTTP server in Webhook Setup
  4. GetAndWriteResourceCoverage: Helper method that uses GetResourceCoverage to retrieve resource coverage and writes output to a file.
  5. GetTotalCoverage: Helper method to retrieve total coverage data for a repo. The coverage data is retrieved from the API that is exposed by the HTTP server in Webhook Setup
  6. GetAndWriteTotalCoverage: Helper method that uses GetTotalCoverage to retrieve total coverage and writes output to a file.

Documentation

Index

Constants

View Source
const (
	// WebhookResourceCoverageEndPoint constant for resource coverage API endpoint.
	WebhookResourceCoverageEndPoint = "https://%s:443" + webhook.ResourceCoverageEndPoint + "?resource=%s"

	// WebhookTotalCoverageEndPoint constant for total coverage API endpoint.
	WebhookTotalCoverageEndPoint = "https://%s:443" + webhook.TotalCoverageEndPoint

	// WebhookResourcePercentageCoverageEndPoint constant for
	// ResourcePercentageCoverage API endpoint.
	WebhookResourcePercentageCoverageEndPoint = "https://%s:443" + webhook.ResourcePercentageCoverageEndPoint
)

Variables

This section is empty.

Functions

func CleanupJunitFiles

func CleanupJunitFiles(artifactsDir string)

Helper function to cleanup any existing Junit XML files. This is done to ensure that we only have one Junit XML file providing the API Coverage summary.

func GetAndWriteResourceCoverage

func GetAndWriteResourceCoverage(webhookIP string, resourceName string, outputFile string, displayRules view.DisplayRules) error

GetAndWriteResourceCoverage is a helper method that uses GetResourceCoverage to get coverage and write it to a file.

func GetAndWriteTotalCoverage

func GetAndWriteTotalCoverage(webhookIP string, outputFile string) error

GetAndWriteTotalCoverage uses the GetTotalCoverage method to get total coverage and write it to a output file.

func GetDefaultKubePath

func GetDefaultKubePath() (string, error)

GetDefaultKubePath helper method to fetch kubeconfig path.

func GetResourceCoverage

func GetResourceCoverage(webhookIP string, resourceName string) (string, error)

GetResourceCoverage is a helper method to get Coverage data for a resource from the service webhook.

func GetResourcePercentages

func GetResourcePercentages(webhookIP string) (
	*coveragecalculator.CoveragePercentages, error)

GetResourcePercentages calls resource percentage coverage API to retrieve percentage values.

func GetTotalCoverage

func GetTotalCoverage(webhookIP string) (*coveragecalculator.CoverageValues, error)

GetTotalCoverage calls the total coverage API to retrieve total coverage values.

func GetWebhookServiceIP

func GetWebhookServiceIP(kubeConfigPath string, clusterName string, namespace string, serviceName string) (string, error)

GetWebhookServiceIP is a helper method to fetch IP Address of the LoadBalancer webhook service.

func WriteResourcePercentages

func WriteResourcePercentages(outputFile string,
	coveragePercentages *coveragecalculator.CoveragePercentages) error

WriteResourcePercentages writes CoveragePercentages to junit_xml output file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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