util.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. Copyright 2017 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // TODO: This file can potentially be moved to a common place used by both e2e and integration tests.
  14. package framework
  15. import (
  16. "net/http/httptest"
  17. "testing"
  18. "k8s.io/api/core/v1"
  19. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  20. )
  21. // CreateTestingNamespace creates a namespace for testing.
  22. func CreateTestingNamespace(baseName string, apiserver *httptest.Server, t *testing.T) *v1.Namespace {
  23. // TODO: Create a namespace with a given basename.
  24. // Currently we neither create the namespace nor delete all of its contents at the end.
  25. // But as long as tests are not using the same namespaces, this should work fine.
  26. return &v1.Namespace{
  27. ObjectMeta: metav1.ObjectMeta{
  28. // TODO: Once we start creating namespaces, switch to GenerateName.
  29. Name: baseName,
  30. },
  31. }
  32. }
  33. // DeleteTestingNamespace is currently a no-op function.
  34. func DeleteTestingNamespace(ns *v1.Namespace, apiserver *httptest.Server, t *testing.T) {
  35. // TODO: Remove all resources from a given namespace once we implement CreateTestingNamespace.
  36. }