test.go 867 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Package test provides useful resources for the testing of gokrb5.
  2. package test
  3. import (
  4. "os"
  5. "testing"
  6. )
  7. // Test enabling environment variable key values.
  8. const (
  9. IntegrationEnvVar = "INTEGRATION"
  10. ADIntegrationEnvVar = "TESTAD"
  11. PrivIntegrationEnvVar = "TESTPRIVILEGED"
  12. )
  13. // Integration skips the test unless the integration test environment variable is set.
  14. func Integration(t *testing.T) {
  15. if os.Getenv(IntegrationEnvVar) != "1" {
  16. t.Skip("Skipping integration test")
  17. }
  18. }
  19. // AD skips the test unless the AD test environment variable is set.
  20. func AD(t *testing.T) {
  21. if os.Getenv(ADIntegrationEnvVar) != "1" {
  22. t.Skip("Skipping AD integration test")
  23. }
  24. }
  25. // Privileged skips the test that require local root privilege.
  26. func Privileged(t *testing.T) {
  27. if os.Getenv(PrivIntegrationEnvVar) != "1" {
  28. t.Skip("Skipping DNS integration test")
  29. }
  30. }