utils

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2019 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2019 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2019 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNodeDeleteStatus

func CheckNodeDeleteStatus(ctx *TestContext, nodehandler, nodename string) int

CheckNodeDeleteStatus to check node delete status

func CheckNodeReadyStatus

func CheckNodeReadyStatus(ctx *TestContext, nodehandler, nodename string) string

CheckNodeReadyStatus to get node status

func CheckPodDeleteState

func CheckPodDeleteState(apiserver string, podlist v1.PodList)

CheckPodDeleteState function to check the Pod state

func CheckPodRunningState

func CheckPodRunningState(apiserver string, podlist v1.PodList)

CheckPodRunningState function to check the Pod state

func DeRegisterNodeFromMaster

func DeRegisterNodeFromMaster(ctx *TestContext, nodehandler, nodename string) error

DeRegisterNodeFromMaster to deregister the node from master

func Debug

func Debug(format string, data []byte, err error)

Function to log DEBUG logs

func DeleteDeployment

func DeleteDeployment(DeploymentApi, deploymentname string) int

DeleteDeployment to delete deployment

func DeletePods

func DeletePods(apiserver string) (string, int)

DeletePods function to get the pod status and response code

func Failf

func Failf(format string, args ...interface{})

Funciton to log Filure logs

func GenerateNodeReqBody

func GenerateNodeReqBody(nodeid, nodeselector string) (error, map[string]interface{})

GenerateNodeReqBody to generate the node request body

func GetDeployments

func GetDeployments(list *apps.DeploymentList, getDeploymentApi string) error

GetDeployments to get the deployments list

func GetPodState

func GetPodState(apiserver string) (string, int)

GetPodState function to get the pod status and response code

func GetPods

func GetPods(apiserver, label string) (v1.PodList, error)

GetPods function to get the pods from Edged

func GetRandomString

func GetRandomString(length int) string

function to Generate Random string

func HandleDeployment

func HandleDeployment(operation, apiserver, UID, ImageUrl, nodeselector string, replica int) bool

HandleDeployment to handle app deployment/delete deployment.

func HandlePod

func HandlePod(operation string, apiserver string, UID string, ImageUrl, nodeselector string) bool

HandlePod to handle app deployment/delete using pod spec.

func Info

func Info(format string, args ...interface{})

function for log level

func InfoV2

func InfoV2(format string, args ...interface{})

function for log level

func InfoV6

func InfoV6(format string, args ...interface{})

function for log level

func Logf

func Logf(format string, args ...interface{})

Function to generate INFO logs

func MapLabels

func MapLabels(ls map[string]string) string

MapLabels function add label selector

func PrintCombinedOutput

func PrintCombinedOutput(cmd *exec.Cmd) error

PrintCombinedOutput to show the os command injuction in combined format

func PrintTestcaseNameandStatus

func PrintTestcaseNameandStatus()

Function to print the test case name and status of execution

func RandomInt

func RandomInt(min, max int) int

func RegisterNodeToMaster

func RegisterNodeToMaster(ctx *TestContext, UID, nodehandler, nodeselector string) error

RegisterNodeToMaster to register node to master

func SendHttpRequest

func SendHttpRequest(method, reqApi string) (error, *http.Response)

SendHttpRequest Function to prepare the http req and send

Types

type Config

type Config struct {
	EdgedEndpoint string   `json:"edgedEndpoint"`
	AppImageUrl   []string `json:"image_url"`
	ApiServer     string   `json:"apiserver"`
}

config.json decode struct

func LoadConfig

func LoadConfig() Config

get config.json path

type TestContext

type TestContext struct {
	Cfg Config
}

Test context struct

func NewTestContext

func NewTestContext(cfg Config) *TestContext

NewTestContext function to build testcontext with provided config.

Jump to

Keyboard shortcuts

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