main

mattermost/focalboard

Last updated at: 29/12/2023 09:40

debug.go

TLDR

This file provides a method named IsRunningUnitTests that checks if the instance of FocalBoard is running unit or integration tests.

Methods

IsRunningUnitTests

This method checks the value of the FOCALBOARD_UNIT_TESTING environment variable. If the variable is empty or not set, it returns false. Otherwise, it converts the value to lowercase and compares it against a list of accepted values (1, t, y, true, yes) and returns true if the value matches, and false otherwise.

package utils

import (
	"os"
	"strings"
)

// IsRunningUnitTests returns true if this instance of FocalBoard is running unit or integration tests.
func IsRunningUnitTests() bool {
	testing := os.Getenv("FOCALBOARD_UNIT_TESTING")
	if testing == "" {
		return false
	}

	switch strings.ToLower(testing) {
	case "1", "t", "y", "true", "yes":
		return true
	}
	return false
}