Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Unit test to force CODER prefix
  • Loading branch information
Emyrk committed Apr 5, 2023
commit 46e5f430cae331feff75e45c32c983d56faec26c
7 changes: 7 additions & 0 deletions codersdk/deployment_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package codersdk_test

import (
"strings"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -101,6 +102,12 @@ func TestDeploymentValues_HighlyConfigurable(t *testing.T) {
t.Errorf("Option %q is excluded but has an env name", opt.Name)
}

// Also check all env vars are prefixed with CODER_
const prefix = "CODER_"
if opt.Env != "" && !strings.HasPrefix(opt.Env, prefix) {
t.Errorf("Option %q has an env name (%q) that is not prefixed with %s", opt.Name, opt.Env, prefix)
}

delete(excludes, opt.Name)
}

Expand Down