makefile_test.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 main_test
  14. import (
  15. "os"
  16. "strings"
  17. "testing"
  18. "github.com/external-secrets/external-secrets/pkg/executil"
  19. )
  20. func TestHelmDocsTargetCanUseLocalCommand(t *testing.T) {
  21. t.Parallel()
  22. cmd, err := executil.Command("make", "-n", "helm.docs", "HELM_DOCS_CMD=helm-docs")
  23. if err != nil {
  24. t.Fatalf("resolve make: %v", err)
  25. }
  26. cmd.Dir = "."
  27. cmd.Env = os.Environ()
  28. output, err := cmd.CombinedOutput()
  29. if err != nil {
  30. t.Fatalf("make dry-run failed: %v\n%s", err, string(output))
  31. }
  32. if !strings.Contains(string(output), "cd deploy/charts/external-secrets;") || !strings.Contains(string(output), "helm-docs") {
  33. t.Fatalf("expected helm.docs dry-run to use HELM_DOCS_CMD override, output:\n%s", string(output))
  34. }
  35. }
  36. func TestLicenseCheckTargetCanUseLocalCommand(t *testing.T) {
  37. t.Parallel()
  38. cmd, err := executil.Command("make", "-n", "license.check", "LICENSE_CHECK_CMD=license-eye header check")
  39. if err != nil {
  40. t.Fatalf("resolve make: %v", err)
  41. }
  42. cmd.Dir = "."
  43. cmd.Env = os.Environ()
  44. output, err := cmd.CombinedOutput()
  45. if err != nil {
  46. t.Fatalf("make dry-run failed: %v\n%s", err, string(output))
  47. }
  48. if !strings.Contains(string(output), "license-eye header check") {
  49. t.Fatalf("expected license.check dry-run to use LICENSE_CHECK_CMD override, output:\n%s", string(output))
  50. }
  51. }