feat: move proxy settings page to deployment options (#8246)

* feat: Move workspace proxy page to deployment options

Workspace proxy settings page is now an admin feature

* WorkspaceProxy response extends region
This commit is contained in:
Steven Masley
2023-06-30 11:32:35 -04:00
committed by GitHub
parent 1e8cc2ca8d
commit f0bd258ff1
39 changed files with 645 additions and 342 deletions
@@ -171,6 +171,11 @@ func (p *ProxyHealth) ForceUpdate(ctx context.Context) error {
// HealthStatus returns the current health status of all proxies stored in the
// cache.
func (p *ProxyHealth) HealthStatus() map[uuid.UUID]ProxyStatus {
if p == nil {
// This can happen because workspace proxies are still an experiment.
// For the /regions endpoint, this will be nil in those cases.
return map[uuid.UUID]ProxyStatus{}
}
ptr := p.cache.Load()
if ptr == nil {
return map[uuid.UUID]ProxyStatus{}
@@ -36,6 +36,14 @@ func insertProxy(t *testing.T, db database.Store, url string) database.Workspace
return proxy
}
// Test the nil guard for experiment off cases.
func TestProxyHealth_Nil(t *testing.T) {
t.Parallel()
var ph *proxyhealth.ProxyHealth
require.NotNil(t, ph.HealthStatus())
}
func TestProxyHealth_Unregistered(t *testing.T) {
t.Parallel()
db := dbfake.New()