Skip to content

Commit

Permalink
Lint fix, godoc, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbattirola committed Oct 30, 2024
1 parent f278597 commit a25a7f0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 56 deletions.
2 changes: 1 addition & 1 deletion lib/web/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2874,7 +2874,7 @@ type GetClusterInfoResponse struct {
IsCloud bool `json:"isCloud"`
}

// getClusterInfo returns the information about the cluster being in the :site param
// getClusterInfo returns the information about the cluster in the :site param
//
// GET /v1/webapi/sites/:site/info
//
Expand Down
53 changes: 0 additions & 53 deletions lib/web/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11266,56 +11266,3 @@ func Test_setEntitlementsWithLegacyLogic(t *testing.T) {
})
}
}

// TestGetClusterInfo tests the getClusterInfo handler.
func TestGetClusterInfo(t *testing.T) {
tests := []struct {
name string
cloud bool
assert func(t *testing.T, err error, statusCode int, resp GetClusterInfoResponse)
}{
{
name: "cloud cluster",
cloud: true,
assert: func(t *testing.T, err error, statusCode int, resp GetClusterInfoResponse) {
require.NoError(t, err)
require.Equal(t, http.StatusOK, statusCode)
require.True(t, resp.IsCloud)
},
},
{
name: "non-cloud cluster",
cloud: false,
assert: func(t *testing.T, err error, statusCode int, resp GetClusterInfoResponse) {
require.NoError(t, err)
require.Equal(t, http.StatusOK, statusCode)
require.False(t, resp.IsCloud)
},
},
}

// Iterate over test cases.
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
modules.SetTestModules(t, &modules.TestModules{
TestFeatures: modules.Features{
Cloud: tc.cloud,
},
})

env := newWebPack(t, 1)
proxy := env.proxies[0]
pack := proxy.authPack(t, "[email protected]", auth.GetPresetRoles())
endpoint := pack.clt.Endpoint("webapi", "sites", env.server.ClusterName(), "info")

var clusterInfo GetClusterInfoResponse
resp, reqErr := pack.clt.Get(context.Background(), endpoint, url.Values{})
if reqErr != nil && resp.Code() == http.StatusOK {
err := json.Unmarshal(resp.Bytes(), &clusterInfo)
require.NoError(t, err)
}

tc.assert(t, reqErr, resp.Code(), clusterInfo)
})
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/**
* Teleport
* Copyright (C) 2024 Gravitational, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import React from 'react';
import { MemoryRouter, Route } from 'react-router-dom';

Expand Down
2 changes: 1 addition & 1 deletion web/packages/teleport/src/Clusters/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { ClusterInfo } from "teleport/services/clusters";
import { ClusterInfo } from 'teleport/services/clusters';

export const clusters = [
{
Expand Down
1 change: 0 additions & 1 deletion web/packages/teleport/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ const cfg = {
deviceTrustAuthorize: '/web/device/authorize/:id?/:token?',
sso: '/web/sso',
cluster: '/web/cluster/:clusterId/',

clusters: '/web/clusters',
manageCluster: '/web/clusters/:clusterId/manage',

Expand Down

0 comments on commit a25a7f0

Please sign in to comment.