Documentation ¶
Overview ¶
Copyright 2021 KubeCube 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 2021 KubeCube 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 2021 KubeCube 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 2021 KubeCube 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 2021 KubeCube 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
- func CreateNamespace(baseName string) (*v1.Namespace, error)
- func DeleteNamespace(ns *v1.Namespace) error
- func ExpectConsistOf(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectEmpty(actual interface{}, explain ...interface{})
- func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectError(err error, explain ...interface{})
- func ExpectHaveKey(actual interface{}, key interface{}, explain ...interface{})
- func ExpectNoError(err error, explain ...interface{})
- func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{})
- func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
- type Framework
- type HttpHelper
- func (h *HttpHelper) FormatUrl(url string) string
- func (h *HttpHelper) Login() *HttpHelper
- func (h *HttpHelper) LoginByUser(username string) *HttpHelper
- func (h *HttpHelper) MultiUserRequest(method, url, body string) map[string]MultiRequestResponse
- func (h *HttpHelper) Request(method, urlVal, data string) http.Request
- type MultiRequestResponse
- type TimeoutContext
Constants ¶
const ( WaitInterval = 2 * time.Second WaitTimeout = 120 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CreateNamespace ¶
Create namespace
func ExpectConsistOf ¶
func ExpectConsistOf(actual interface{}, extra interface{}, explain ...interface{})
ExpectConsistOf expects actual contains precisely the extra elements. The ordering of the elements does not matter.
func ExpectEmpty ¶
func ExpectEmpty(actual interface{}, explain ...interface{})
ExpectEmpty expects actual is empty
func ExpectEqual ¶
func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectEqual expects the specified two are the same, otherwise an exception raises
func ExpectError ¶
func ExpectError(err error, explain ...interface{})
ExpectError expects an error happens, otherwise an exception raises
func ExpectHaveKey ¶
func ExpectHaveKey(actual interface{}, key interface{}, explain ...interface{})
ExpectHaveKey expects the actual map has the key in the keyset
func ExpectNoError ¶
func ExpectNoError(err error, explain ...interface{})
ExpectNoError checks if "err" is set, and if so, fails assertion while logging the error.
func ExpectNoErrorWithOffset ¶
ExpectNoErrorWithOffset checks if "err" is set, and if so, fails assertion while logging the error at "offset" levels above its caller (for example, for call chain f -> g -> ExpectNoErrorWithOffset(1, ...) error would be logged for "f").
func ExpectNotEqual ¶
func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectNotEqual expects the specified two are not the same, otherwise an exception raises
Types ¶
type Framework ¶
type Framework struct { BaseName string // Http client Host string HttpHelper *HttpHelper // Timeouts contains the custom timeouts used during the test execution. Timeouts *TimeoutContext // preset tenant/project/namespace TenantName string ProjectName string Namespace string }
Framework supports common operations used by e2e tests; it will keep a client & a namespace for you.
func NewDefaultFramework ¶
NewFramework creates a test framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).
func NewFramework ¶
type HttpHelper ¶
type HttpHelper struct { HostPath string Admin string TenantAdmin string ProjectAdmin string User string Client http.Client Cookies []*http.Cookie }
func NewHttpHelper ¶
func NewHttpHelper() *HttpHelper
func (*HttpHelper) FormatUrl ¶
func (h *HttpHelper) FormatUrl(url string) string
func (*HttpHelper) Login ¶
func (h *HttpHelper) Login() *HttpHelper
func (*HttpHelper) LoginByUser ¶
func (h *HttpHelper) LoginByUser(username string) *HttpHelper
func (*HttpHelper) MultiUserRequest ¶
func (h *HttpHelper) MultiUserRequest(method, url, body string) map[string]MultiRequestResponse
multi user request test
type MultiRequestResponse ¶
type TimeoutContext ¶
type TimeoutContext struct { // HttpRequest is how long to wait for the http request HttpRequest time.Duration // ResourceCreate is how long to wait for resource creation // Use it in case create fail and hold WaitInterval time.Duration // ResourceCreate is how long to wait for resource delete // Use it in case delete fail and hold WaitTimeout time.Duration }
TimeoutContext contains timeout settings for several actions.
func NewTimeoutContextWithDefaults ¶
func NewTimeoutContextWithDefaults() *TimeoutContext
NewTimeoutContextWithDefaults returns a TimeoutContext with default values.