Documentation
¶
Index ¶
- Constants
- Variables
- func CreateFile(fileName, fileContent, filePath string, fileMode os.FileMode) (string, error)
- func CreateNamespace(namespace string) error
- func CurrentDir(t *testing.T) string
- func DeleteNamespace(namespace string) error
- func FindConfigurationGeneration(r *KnRunResultCollector, serviceName string) int
- func FindRevision(r *KnRunResultCollector, serviceName string) string
- func FindRevisionByGeneration(r *KnRunResultCollector, serviceName string, generation int) string
- func GetNextNamespaceId() int
- func GetNextServiceName(base string) string
- func GetResourceFieldsWithJSONPath(t *testing.T, it *KnTest, resource, name, jsonpath string) (string, error)
- func NextNamespace() string
- func RevisionDelete(r *KnRunResultCollector, revName string)
- func RevisionDescribe(r *KnRunResultCollector, serviceName string)
- func RevisionDescribeWithPrintFlags(r *KnRunResultCollector, revName string)
- func RevisionListForService(r *KnRunResultCollector, serviceName string)
- func RevisionListOutputName(r *KnRunResultCollector, revisionName string)
- func RevisionListWithService(r *KnRunResultCollector, serviceNames ...string)
- func RevisionMultipleDelete(r *KnRunResultCollector, ...)
- func RunKubectl(namespace string, args ...string) (string, error)
- func ServiceCreate(r *KnRunResultCollector, serviceName string)
- func ServiceDelete(r *KnRunResultCollector, serviceName string)
- func ServiceDescribe(r *KnRunResultCollector, serviceName string)
- func ServiceDescribeWithJSONPath(r *KnRunResultCollector, serviceName, jsonpath string) string
- func ServiceList(r *KnRunResultCollector, serviceName string)
- func ServiceListEmpty(r *KnRunResultCollector)
- func ServiceListOutput(r *KnRunResultCollector, serviceName string)
- func ServiceUpdate(r *KnRunResultCollector, serviceName string, args ...string)
- func ValidateServiceResources(r *KnRunResultCollector, serviceName string, ...)
- func WaitForNamespaceCreated(namespace string) error
- func WaitForNamespaceDeleted(namespace string) error
- type ClientFlags
- type Kn
- type KnRunResult
- type KnRunResultCollector
- func (c *KnRunResultCollector) AddDump(kind string, name string, namespace string)
- func (c *KnRunResultCollector) AssertError(result KnRunResult)
- func (c *KnRunResultCollector) AssertNoError(result KnRunResult)
- func (c *KnRunResultCollector) DumpIfFailed()
- func (c *KnRunResultCollector) KnTest() *KnTest
- func (c *KnRunResultCollector) T() *testing.T
- type KnTest
- type Kubectl
Constants ¶
const ( KnDefaultTestImage string = "gcr.io/knative-samples/helloworld-go" MaxRetries int = 10 RetrySleepDuration time.Duration = 5 * time.Second )
const ( FileModeReadWrite = 0666 FileModeExecutable = 0777 )
Variables ¶
var Flags = InitializeFlags()
Flags holds the command line flags or defaults for settings in the user's environment. See ClientFlags for the list of supported fields.
Functions ¶
func CreateFile ¶ added in v0.15.0
CreateFile creates a file with given name, content, path, fileMode and returns absolute filepath and error if any
func CreateNamespace ¶
CreateNamespace creates and tests a namesspace creation invoking kubectl
func CurrentDir ¶
func DeleteNamespace ¶
DeleteNamespace deletes and tests a namesspace deletion invoking kubectl
func FindConfigurationGeneration ¶ added in v0.15.0
func FindConfigurationGeneration(r *KnRunResultCollector, serviceName string) int
FindConfigurationGeneration returns the configuration generation number of given service
func FindRevision ¶ added in v0.15.0
func FindRevision(r *KnRunResultCollector, serviceName string) string
FindRevision returns a revision name (at index 0) for given service
func FindRevisionByGeneration ¶ added in v0.15.0
func FindRevisionByGeneration(r *KnRunResultCollector, serviceName string, generation int) string
FindRevisionByGeneration returns a revision name for given revision at given generation number
func GetNextNamespaceId ¶
func GetNextNamespaceId() int
GetNextNamespaceId return the next unique ID for the next namespace
func GetNextServiceName ¶
GetNextServiceName return the name for the next namespace
func GetResourceFieldsWithJSONPath ¶ added in v0.15.0
func GetResourceFieldsWithJSONPath(t *testing.T, it *KnTest, resource, name, jsonpath string) (string, error)
GetResourceFieldsWithJSONPath returns output of given JSON path for given resource using kubectl and error if any
func RevisionDelete ¶ added in v0.15.0
func RevisionDelete(r *KnRunResultCollector, revName string)
RevisionDelete verifies deleting given revision in sync mode
func RevisionDescribe ¶ added in v0.15.0
func RevisionDescribe(r *KnRunResultCollector, serviceName string)
RevisionDescribe verifies revision describe output for given service's revision
func RevisionDescribeWithPrintFlags ¶ added in v0.15.0
func RevisionDescribeWithPrintFlags(r *KnRunResultCollector, revName string)
RevisionDescribeWithPrintFlags verifies describing given revision using print flag '--output=name'
func RevisionListForService ¶ added in v0.15.0
func RevisionListForService(r *KnRunResultCollector, serviceName string)
RevisionListForService list revisions of given service and verifies if their status is True
func RevisionListOutputName ¶ added in v0.15.0
func RevisionListOutputName(r *KnRunResultCollector, revisionName string)
RevisionListOutputName verifies listing given revision using print flag '--output name'
func RevisionListWithService ¶ added in v0.15.0
func RevisionListWithService(r *KnRunResultCollector, serviceNames ...string)
RevisionListWithService verifies listing revisions per service from each given service names
func RevisionMultipleDelete ¶ added in v0.15.0
func RevisionMultipleDelete(r *KnRunResultCollector, existRevision1, existRevision2, nonexistRevision string)
RevisionMultipleDelete verifies deleting multiple revisions
func RunKubectl ¶
RunKubectl runs "kubectl" in a given namespace
func ServiceCreate ¶ added in v0.15.0
func ServiceCreate(r *KnRunResultCollector, serviceName string)
ServiceCreate verifies given service creation in sync mode and also verifies output
func ServiceDelete ¶ added in v0.15.0
func ServiceDelete(r *KnRunResultCollector, serviceName string)
ServiceDelete verifies service deletion in sync mode
func ServiceDescribe ¶ added in v0.15.0
func ServiceDescribe(r *KnRunResultCollector, serviceName string)
ServiceDescribe describes given service and verifies the keys in the output
func ServiceDescribeWithJSONPath ¶ added in v0.15.0
func ServiceDescribeWithJSONPath(r *KnRunResultCollector, serviceName, jsonpath string) string
ServiceDescribeWithJSONPath returns output of given JSON path by describing the service
func ServiceList ¶ added in v0.15.0
func ServiceList(r *KnRunResultCollector, serviceName string)
ServiceList verifies if given service exists
func ServiceListEmpty ¶ added in v0.15.0
func ServiceListEmpty(r *KnRunResultCollector)
ServiceListEmpty verifies that there are no services present
func ServiceListOutput ¶ added in v0.15.0
func ServiceListOutput(r *KnRunResultCollector, serviceName string)
ServiceListOutput verifies listing given service using '--output name' flag
func ServiceUpdate ¶ added in v0.15.0
func ServiceUpdate(r *KnRunResultCollector, serviceName string, args ...string)
ServiceUpdate verifies service update operation with given arguments in sync mode
func ValidateServiceResources ¶ added in v0.15.0
func ValidateServiceResources(r *KnRunResultCollector, serviceName string, requestsMemory, requestsCPU, limitsMemory, limitsCPU string)
func WaitForNamespaceCreated ¶
WaitForNamespaceCreated wait until namespace is created
func WaitForNamespaceDeleted ¶
WaitForNamespaceDeleted wait until namespace is deleted
Types ¶
type ClientFlags ¶
type ClientFlags struct {
DockerConfigJSON string
}
ClientFlags define the flags that are needed to run the e2e tests.
func InitializeFlags ¶
func InitializeFlags() *ClientFlags
InitializeFlags initializes the client's flags
type Kn ¶
type Kn struct {
// contains filtered or unexported fields
}
Kn type
func (Kn) RunNoNamespace ¶ added in v0.14.0
func (k Kn) RunNoNamespace(args ...string) KnRunResult
RunNoNamespace the 'kn' CLI with args but no namespace
type KnRunResult ¶
type KnRunResult struct {
// Command line called
CmdLine string
// Standard output of command
Stdout string
// Standard error of command
Stderr string
// And extra dump informations in case of an unexpected error
DumpInfo string
// Error occurred during execution
Error error
// Was an error expected ?
ErrorExpected bool
}
KnRunResult holds command and result artifacts of a "kn" call
func RunKn ¶
func RunKn(namespace string, args []string) KnRunResult
RunKn runs "kn" in a given namespace
type KnRunResultCollector ¶
type KnRunResultCollector struct {
// contains filtered or unexported fields
}
KnRunResultCollector collects Kn run's results
func NewKnRunResultCollector ¶
func NewKnRunResultCollector(t *testing.T, knTest *KnTest) *KnRunResultCollector
NewKnRunResultCollector returns a new KnRunResultCollector
func (*KnRunResultCollector) AddDump ¶
func (c *KnRunResultCollector) AddDump(kind string, name string, namespace string)
AddDump adds extra dump information to the collector which is printed out if an error occurs
func (*KnRunResultCollector) AssertError ¶
func (c *KnRunResultCollector) AssertError(result KnRunResult)
AssertError helper to assert error on result
func (*KnRunResultCollector) AssertNoError ¶
func (c *KnRunResultCollector) AssertNoError(result KnRunResult)
AssertNoError helper to assert no error on result
func (*KnRunResultCollector) DumpIfFailed ¶
func (c *KnRunResultCollector) DumpIfFailed()
DumpIfFailed logs if collector failed
func (*KnRunResultCollector) KnTest ¶ added in v0.14.0
func (c *KnRunResultCollector) KnTest() *KnTest
KnTest returns the KnTest object
func (*KnRunResultCollector) T ¶ added in v0.14.0
func (c *KnRunResultCollector) T() *testing.T
T returns the *testing.T object