eso_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. Copyright © The ESO 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. https://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. package addon
  14. import "testing"
  15. func TestNeedsCRDPreinstallForV2ProvidersWhenHelmWouldCreateCRDs(t *testing.T) {
  16. t.Setenv("VERSION", "test-version")
  17. eso := NewESO(WithCRDs(), WithV2FakeProvider())
  18. if !needsCRDPreinstall(eso.HelmChart) {
  19. t.Fatal("expected v2 provider install with installCRDs=true to require CRD preinstall")
  20. }
  21. }
  22. func TestNeedsCRDPreinstallDisabledWhenHelmCRDsDisabled(t *testing.T) {
  23. t.Setenv("VERSION", "test-version")
  24. eso := NewESO(WithV2FakeProvider())
  25. if needsCRDPreinstall(eso.HelmChart) {
  26. t.Fatal("did not expect CRD preinstall when installCRDs=false")
  27. }
  28. }
  29. func TestNeedsCRDPreinstallForDefaultV2RuntimeCRDs(t *testing.T) {
  30. eso := NewESO(WithCRDs())
  31. if !needsCRDPreinstall(eso.HelmChart) {
  32. t.Fatal("expected default chart v2 runtime CRDs to require CRD preinstall")
  33. }
  34. }