diff --git a/functional-tests/admin_tests/performance_test_prep.sh b/functional-tests/admin_tests/performance_test_prep.sh index 8467729..e925cb4 100755 --- a/functional-tests/admin_tests/performance_test_prep.sh +++ b/functional-tests/admin_tests/performance_test_prep.sh @@ -56,4 +56,6 @@ curl -s --fail-with-body ${PROXY_URL}/svctest -H Host:dgate.dev curl -s --fail-with-body ${PROXY_URL}/modtest -H Host:dgate.dev -curl -s ${PROXY_URL}/blank -H Host:dgate.dev \ No newline at end of file +curl -s ${PROXY_URL}/blank -H Host:dgate.dev + +echo "Performance Test Prep Done" \ No newline at end of file diff --git a/internal/config/config.go b/internal/config/config.go index 96b8a12..c192200 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -179,7 +179,7 @@ type ( } DomainSpec struct { - *spec.Domain `koanf:",squash"` + spec.Domain `koanf:",squash"` CertFile string `koanf:"cert_file"` KeyFile string `koanf:"key_file"` } diff --git a/internal/config/configtest/dgate_configs.go b/internal/config/configtest/dgate_configs.go index 1beb819..629aba8 100644 --- a/internal/config/configtest/dgate_configs.go +++ b/internal/config/configtest/dgate_configs.go @@ -102,7 +102,7 @@ func NewTestDGateConfig_DomainAndNamespaces() *config.DGateConfig { } conf.ProxyConfig.InitResources.Domains = []config.DomainSpec{ { - Domain: &spec.Domain{ + Domain: spec.Domain{ Name: "test-dm", NamespaceName: "test", Patterns: []string{"example.com"}, @@ -111,7 +111,7 @@ func NewTestDGateConfig_DomainAndNamespaces() *config.DGateConfig { }, }, { - Domain: &spec.Domain{ + Domain: spec.Domain{ Name: "test-dm2", NamespaceName: "test2", Patterns: []string{`*test.com`}, @@ -120,7 +120,7 @@ func NewTestDGateConfig_DomainAndNamespaces() *config.DGateConfig { }, }, { - Domain: &spec.Domain{ + Domain: spec.Domain{ Name: "test-dm3", NamespaceName: "test3", Patterns: []string{`/^(abc|cba).test.com$/`}, diff --git a/internal/config/resources.go b/internal/config/resources.go index 413b1eb..0f8b2a6 100644 --- a/internal/config/resources.go +++ b/internal/config/resources.go @@ -128,7 +128,7 @@ func (resources *DGateResources) Validate() (int, error) { if (dom.Cert == "") != (dom.Key == "") { return 0, errors.New("domain cert (file) and key (file) must both be specified, or neither") } - domains[key] = dom.Domain + domains[key] = &dom.Domain } numChanges += len(domains) diff --git a/internal/config/resources_test.go b/internal/config/resources_test.go index 7bafda6..78fde73 100644 --- a/internal/config/resources_test.go +++ b/internal/config/resources_test.go @@ -32,7 +32,7 @@ func TestValidate(t *testing.T) { }, Domains: []DomainSpec{ { - Domain: &spec.Domain{ + Domain: spec.Domain{ Name: "default", NamespaceName: "default", Tags: []string{"default"}, diff --git a/internal/proxy/change_log.go b/internal/proxy/change_log.go index 02a71ae..1085453 100644 --- a/internal/proxy/change_log.go +++ b/internal/proxy/change_log.go @@ -113,10 +113,7 @@ func (ps *ProxyState) processChangeLog( } if store { if err = ps.store.StoreChangeLog(cl); err != nil { - // TODO: Add config option to panic on persistent storage errors - // TODO: maybe revert change here - // add some in-memory queue for changes? - // add some retry mechanism? + // TODO: revert change here on error ?? ps.logger.Err(err).Msg("Error storing change log") return } diff --git a/internal/proxy/proxy_state.go b/internal/proxy/proxy_state.go index 045e72d..9abd3b2 100644 --- a/internal/proxy/proxy_state.go +++ b/internal/proxy/proxy_state.go @@ -446,7 +446,7 @@ func (ps *ProxyState) initConfigResources(resources *config.DGateResources) erro } dom.Key = string(key) } - cl := spec.NewChangeLog(dom.Domain, dom.NamespaceName, spec.AddDomainCommand) + cl := spec.NewChangeLog(&dom.Domain, dom.NamespaceName, spec.AddDomainCommand) err := ps.processChangeLog(cl, false, false) if err != nil { return err diff --git a/internal/proxy/reverse_proxy/reverse_proxy_test.go b/internal/proxy/reverse_proxy/reverse_proxy_test.go index 6a3e1cc..9d5257d 100644 --- a/internal/proxy/reverse_proxy/reverse_proxy_test.go +++ b/internal/proxy/reverse_proxy/reverse_proxy_test.go @@ -84,12 +84,6 @@ func testDGateProxyRewrite( if params.newHost != "" && req.Host != params.newHost { t.Errorf("FAIL: Expected Host %s, got %s", params.newHost, req.Host) } - // if req.Header.Get("X-Testing") == "" { - // t.Errorf("FAIL: Expected X-Testing header, got empty") - // } - // if req.Header.Get("X-Testing-2") == "" { - // t.Errorf("FAIL: Expected X-Testing-2 header, got empty") - // } if rewriteParams.xForwardedHeaders { if req.Header.Get("X-Forwarded-For") == "" { t.Errorf("FAIL: Expected X-Forwarded-For header, got empty") diff --git a/performance-tests/perf-test.js b/performance-tests/perf-test.js index dce8b4b..3146807 100644 --- a/performance-tests/perf-test.js +++ b/performance-tests/perf-test.js @@ -4,25 +4,25 @@ import { check } from 'k6'; const n = 10; export let options = { scenarios: { - // modtest: { - // executor: 'constant-vus', - // vus: n, - // duration: '20s', - // // same function as the scenario above, but with different env vars - // exec: 'dgatePath', - // env: { DGATE_PATH: '/modtest' }, - // // startTime: '25s', - // gracefulStop: '5s', - // }, - svctest: { + modtest: { executor: 'constant-vus', vus: n, duration: '20s', - exec: 'dgatePath', // same function as the scenario above, but with different env vars - env: { DGATE_PATH: "/svctest" }, + // same function as the scenario above, but with different env vars + exec: 'dgatePath', + env: { DGATE_PATH: '/modtest' }, // startTime: '25s', gracefulStop: '5s', }, + // svctest: { + // executor: 'constant-vus', + // vus: n, + // duration: '20s', + // exec: 'dgatePath', // same function as the scenario above, but with different env vars + // env: { DGATE_PATH: "/svctest" }, + // // startTime: '25s', + // gracefulStop: '5s', + // }, // blank: { // executor: 'constant-vus', // vus: n, diff --git a/pkg/storage/badger_logger.go b/pkg/storage/badger_logger.go index 61b68bd..42ac1ab 100644 --- a/pkg/storage/badger_logger.go +++ b/pkg/storage/badger_logger.go @@ -26,9 +26,6 @@ func (b *badgerLoggerAdapter) Debugf(format string, args ...any) { } func newBadgerLoggerAdapter(component string, logger zerolog.Logger) badger.Logger { - // logger := fsConfig.Logger.Hook(zerolog.HookFunc(func(e *zerolog.Event, level zerolog.Level, msg string) { - // e.Str("storage", "filestore::badger") - // })) logger = logger.With().Str("component", component).Logger() return &badgerLoggerAdapter{ logger: logger,