Documentation ¶
Index ¶
- Variables
- func AssertFileExists(executable string) string
- func IsPodRunning(podName string, numberOfAttempts int, sleepBetweenAttempts time.Duration) bool
- func PreparePublisher(loader *snap.PluginLoader) (cleanup func(), publisher *wmap.PublishWorkflowMapNode, ...)
- func ReadAndTestPublisherData(dataFilePath string, expectedMetrics map[string]string) (validData bool)
- func RunAndTestSnaptel() (cleanup func(), loader *snap.PluginLoader, snaptelURL string)
- func WipeTestClusterFromSurfaceOfTheEarth(handle executor.TaskHandle)
- type FilePublisherMetric
- type KubeClient
- type Snapteld
Constants ¶
This section is empty.
Variables ¶
var SwanPath = path.Join(os.Getenv("GOPATH"), "src", "github.com/intelsdi-x/swan")
SwanPath is an absolute path of project.
Functions ¶
func AssertFileExists ¶
AssertFileExists makes sure that executable is available in $PATH or panics returning location of executable.
func IsPodRunning ¶
IsPodRunning checks if pod is in Running state.
func PreparePublisher ¶
func PreparePublisher(loader *snap.PluginLoader) (cleanup func(), publisher *wmap.PublishWorkflowMapNode, publisherMetricsFile string)
PreparePublisher creates session publisher and publisher output file, returns cleanup function, publisher and file name where publisher data will be stored
func ReadAndTestPublisherData ¶
func ReadAndTestPublisherData(dataFilePath string, expectedMetrics map[string]string) (validData bool)
ReadAndTestPublisherData reads publisher output, when data are read, function checks if we have all data, if we have all columns, if yes, then we compare read data against expectedMetrics. Function returns bool, which if true means that all data are valid, if false - data have not been read properly. If data do not match expected data, convey.So is "thrown"
func RunAndTestSnaptel ¶
func RunAndTestSnaptel() (cleanup func(), loader *snap.PluginLoader, snaptelURL string)
RunAndTestSnaptel checks snapteld on returning cleanup function, plugin loader and string with snapteld address Note: It is facade function that assumes snapteld is running all the time. But can be easily replaced with self-provided snapteld.
func WipeTestClusterFromSurfaceOfTheEarth ¶
func WipeTestClusterFromSurfaceOfTheEarth(handle executor.TaskHandle)
WipeTestClusterFromSurfaceOfTheEarth does a lot to make sure that Kubernetes cluster is stopped and there are not artifacts in etcd or /var/lib/kubelet.
Types ¶
type FilePublisherMetric ¶
type FilePublisherMetric struct { // Namespace contains snap metric namespace. Namespace string `json:"namespace"` // Data contains snap metric value. Data interface{} `json:"data"` // Tags contains map of tags from metric. Tags map[string]string `json:"tags"` }
FilePublisherMetric is used for decoding content of file publisher.
func GetMetric ¶
func GetMetric(namespace string, metrics []FilePublisherMetric) (*FilePublisherMetric, error)
GetMetric returns FilePublisherMetric structure with requested metric's namespace.
func GetOneMeasurementFromFile ¶
func GetOneMeasurementFromFile(fileLocation string) ([]FilePublisherMetric, error)
GetOneMeasurementFromFile gets one random measurement from file.
type KubeClient ¶
type KubeClient struct { Clientset *kubernetes.Clientset // contains filtered or unexported fields }
KubeClient is a helper struct to communicate with K8s API. It stores Kubernetes client and extends it to additional functionality needed by integration tests.
func NewKubeClient ¶
func NewKubeClient(kubernetesConfig executor.KubernetesConfig) (*KubeClient, error)
NewKubeClient creates KubeClient object based on given KubernetesConfig structure. It returns error if given configuration is invalid.
func (*KubeClient) DeletePod ¶
func (k *KubeClient) DeletePod(podName string) error
DeletePod with given podName.
func (*KubeClient) TaintNode ¶
func (k *KubeClient) TaintNode()
TaintNode with NoSchedule taint (can panic).
func (*KubeClient) UntaintNode ¶
func (k *KubeClient) UntaintNode()
UntaintNode removes all tains for given node (can panic on failure).
type Snapteld ¶
type Snapteld struct {
// contains filtered or unexported fields
}
Snapteld represents Snap daemon used in tests.
func NewSnapteld ¶
func NewSnapteld() *Snapteld
NewSnapteld constructs Snapteld on random high ports.
func NewSnapteldOnDefaultPorts ¶
func NewSnapteldOnDefaultPorts() *Snapteld
NewSnapteldOnDefaultPorts constructs Snapteld on chosen ports.
func NewSnapteldOnPort ¶
NewSnapteldOnPort constructs Snapteld on chosen ports.
func (*Snapteld) CleanAndEraseOutput ¶
CleanAndEraseOutput cleans and removes Output.