github.com/jcmturner/gokrb5/v8@v8.4.4/test/test.go (about)

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