2024-12-19 18:49:22 +00:00
|
|
|
package env_test
|
|
|
|
|
|
|
|
|
|
import (
|
2024-12-24 17:13:48 +00:00
|
|
|
"queryorchestration/internal/env"
|
2024-12-19 18:49:22 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
2024-12-24 18:11:25 +00:00
|
|
|
func TestGetPanic(t *testing.T) {
|
2024-12-19 18:49:22 +00:00
|
|
|
name := "test_get_env_var_does_not_exist"
|
|
|
|
|
|
|
|
|
|
value := "value"
|
2025-01-08 18:14:15 +00:00
|
|
|
t.Setenv(name, value)
|
2024-12-19 18:49:22 +00:00
|
|
|
|
2024-12-24 18:11:25 +00:00
|
|
|
returnValue := env.GetPanic(name)
|
2024-12-19 18:49:22 +00:00
|
|
|
|
|
|
|
|
assert.Equal(t, value, returnValue)
|
|
|
|
|
|
|
|
|
|
value = ""
|
2025-01-08 18:14:15 +00:00
|
|
|
t.Setenv(name, value)
|
2024-12-19 18:49:22 +00:00
|
|
|
|
2024-12-24 18:11:25 +00:00
|
|
|
assert.Panics(t, func() { env.GetPanic(name) })
|
2024-12-19 18:49:22 +00:00
|
|
|
}
|