This repository has been archived by the owner on Mar 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We seem to hit an int overflow somewhere when printing out the data sizes, and the first columen has a tendency to waste a lot of screen space. concourse/concourse#6140 Signed-off-by: Jamie Klassen <[email protected]> Co-authored-by: Zoe Tian <[email protected]>
- Loading branch information
Jamie Klassen
and
Zoe Tian
committed
Oct 8, 2020
1 parent
c231c1b
commit 0bf4de4
Showing
5 changed files
with
142 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package accounts_test | ||
|
||
import ( | ||
"net" | ||
|
||
"code.cloudfoundry.org/garden" | ||
"code.cloudfoundry.org/garden/gardenfakes" | ||
"code.cloudfoundry.org/garden/server" | ||
"code.cloudfoundry.org/lager/lagertest" | ||
"github.com/concourse/ft/accounts" | ||
"github.com/stretchr/testify/require" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type GardenConnectionSuite struct { | ||
suite.Suite | ||
*require.Assertions | ||
gardenServer *server.GardenServer | ||
backend *gardenfakes.FakeBackend | ||
listener net.Listener | ||
} | ||
|
||
func (s *GardenConnectionSuite) SetupTest() { | ||
s.backend = new(gardenfakes.FakeBackend) | ||
s.gardenServer = server.New( | ||
"tcp", | ||
"127.0.0.1:7777", | ||
0, | ||
s.backend, | ||
lagertest.NewTestLogger("test"), | ||
) | ||
s.listener, _ = net.Listen("tcp", "127.0.0.1:7777") | ||
go s.gardenServer.Serve(s.listener) | ||
} | ||
|
||
func (s *GardenConnectionSuite) TearDownTest() { | ||
s.gardenServer.Stop() | ||
s.listener.Close() | ||
} | ||
|
||
func (s *LANWorkerSuite) TestGetsAllMetrics() { | ||
metricsEntry := garden.ContainerMetricsEntry{ | ||
Metrics: garden.Metrics{ | ||
MemoryStat: garden.ContainerMemoryStat{ | ||
TotalActiveAnon: 123, | ||
}, | ||
}, | ||
Err: nil, | ||
} | ||
s.backend.BulkMetricsReturns(map[string]garden.ContainerMetricsEntry{ | ||
"container-handle": metricsEntry, | ||
}, nil) | ||
|
||
connection := accounts.GardenConnection{ | ||
Dialer: &accounts.LANGardenDialer{}, | ||
} | ||
metricsEntries, err := connection.AllMetrics() | ||
|
||
s.NoError(err) | ||
s.Len(metricsEntries, 1) | ||
s.Contains(metricsEntries, "container-handle") | ||
s.Equal(metricsEntry, metricsEntries["container-handle"]) | ||
} | ||
|
||
// a container "exists" if it appears in the output from List | ||
// BulkMetrics fails if you ask about nonexistent containers | ||
// BulkMetrics actually returns metrics for the containers you asked about |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters