MCPcopy Create free account
hub / github.com/anchordotdev/cli / TestConfigLoadENV

Function TestConfigLoadENV

config_test.go:17–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestConfigLoadENV(t *testing.T) {
18 tests := []struct {
19 name string
20
21 env map[string]string
22
23 cfgFn func(*Config)
24 }{
25 {
26 name: "empty-environment",
27
28 env: map[string]string{},
29
30 cfgFn: func(cfg *Config) {},
31 },
32 {
33 name: "exhaustive",
34
35 env: map[string]string{
36 "ANCHOR_CLI_KEYRING_MOCK_MODE": "true",
37 "ANCHOR_CLI_TRUSTSTORE_MOCK_MODE": "true",
38 "ANCHOR_CONFIG": "other-anchor.toml",
39 "ANCHOR_HOST": "https://anchor.example.com",
40 "ANCHOR_SKIP_CONFIG": "true",
41 "API_TOKEN": "s3cr3t!",
42 "API_URL": "https://api.anchor.example.com/v0",
43 "CERT_STATES": "valid",
44 "CERT_STYLE": "acme",
45 "DIAGNOSTIC_ADDR": ":4321",
46 "DIAGNOSTIC_SUBDOMAIN": "ankydotdev",
47 "ENV_OUTPUT": "dotenv",
48 "LCL_HOST_URL": "https://lcl.host.example.com",
49 "NON_INTERACTIVE": "true",
50 "NO_SUDO": "true",
51 "ORG": "test-org",
52 "REALM": "test-realm",
53 "SERVICE": "test-service",
54 "SERVICE_CATEGORY": "rubby",
55 "SERVICE_FRAMEWORK": "rubby-on-rails",
56 "SERVICE_NAME": "test-rails-app",
57 "TRUST_STORES": "mock",
58 },
59
60 cfgFn: func(cfg *Config) {
61 cfg.File.Path = "other-anchor.toml"
62 cfg.File.Skip = true
63 cfg.API.URL = "https://api.anchor.example.com/v0"
64 cfg.API.Token = "s3cr3t!"
65 cfg.Dashboard.URL = "https://anchor.example.com"
66 cfg.Lcl.LclHostURL = "https://lcl.host.example.com"
67 cfg.Lcl.RealmAPID = "test-realm"
68 cfg.Lcl.Diagnostic.Addr = ":4321"
69 cfg.Lcl.Diagnostic.Subdomain = "ankydotdev"
70 cfg.NonInteractive = true
71 cfg.Org.APID = "test-org"
72 cfg.Realm.APID = "test-realm"
73 cfg.Service.APID = "test-service"
74 cfg.Service.Category = "rubby"

Callers

nothing calls this directly

Calls 3

loadENVMethod · 0.95
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected