Skip to content

Commit eaf506d

Browse files
committed
The AllFacadeVersions method of api.Connection is unused - remove it.
1 parent 535b259 commit eaf506d

File tree

3 files changed

+0
-41
lines changed

3 files changed

+0
-41
lines changed

api/apiclient.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,15 +1366,6 @@ func (s *state) PublicDNSName() string {
13661366
return s.publicDNSName
13671367
}
13681368

1369-
// AllFacadeVersions returns what versions we know about for all facades
1370-
func (s *state) AllFacadeVersions() map[string][]int {
1371-
facades := make(map[string][]int, len(s.facadeVersions))
1372-
for name, versions := range s.facadeVersions {
1373-
facades[name] = append([]int{}, versions...)
1374-
}
1375-
return facades
1376-
}
1377-
13781369
// BestFacadeVersion compares the versions of facades that we know about, and
13791370
// the versions available from the server, and reports back what version is the
13801371
// 'best available' to use.

api/interface.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ type Connection interface {
303303
// NOTE: This method is deprecated. Please use IsBroken or Broken instead.
304304
Ping() error
305305

306-
// I think this is actually dead code. It's tested, at least, so I'm
307-
// keeping it for now, but it's not apparently used anywhere else.
308-
AllFacadeVersions() map[string][]int
309-
310306
// AuthTag returns the tag of the authorized user of the state API
311307
// connection.
312308
AuthTag() names.Tag

api/state_test.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -246,34 +246,6 @@ func (s *stateSuite) TestLoginMacaroonInvalidId(c *gc.C) {
246246
c.Assert(err, gc.ErrorMatches, "interaction required but not possible")
247247
}
248248

249-
func (s *stateSuite) TestLoginTracksFacadeVersions(c *gc.C) {
250-
apistate, tag, password := s.OpenAPIWithoutLogin(c)
251-
defer apistate.Close()
252-
// We haven't called Login yet, so the Facade Versions should be empty
253-
c.Check(apistate.AllFacadeVersions(), gc.HasLen, 0)
254-
err := apistate.Login(tag, password, "", nil)
255-
c.Assert(err, jc.ErrorIsNil)
256-
// Now that we've logged in, AllFacadeVersions should be updated.
257-
allVersions := apistate.AllFacadeVersions()
258-
c.Check(allVersions, gc.Not(gc.HasLen), 0)
259-
// For sanity checking, ensure that we have a v2 of the Client facade
260-
c.Assert(allVersions["Client"], gc.Not(gc.HasLen), 0)
261-
c.Check(allVersions["Client"][0], gc.Equals, 1)
262-
}
263-
264-
func (s *stateSuite) TestAllFacadeVersionsSafeFromMutation(c *gc.C) {
265-
allVersions := s.APIState.AllFacadeVersions()
266-
clients := allVersions["Client"]
267-
origClients := make([]int, len(clients))
268-
copy(origClients, clients)
269-
// Mutating the dict should not affect the cached versions
270-
allVersions["Client"] = append(allVersions["Client"], 2597)
271-
newVersions := s.APIState.AllFacadeVersions()
272-
newClientVers := newVersions["Client"]
273-
c.Check(newClientVers, gc.DeepEquals, origClients)
274-
c.Check(newClientVers[len(newClientVers)-1], gc.Not(gc.Equals), 2597)
275-
}
276-
277249
func (s *stateSuite) TestBestFacadeVersion(c *gc.C) {
278250
c.Check(s.APIState.BestFacadeVersion("Client"), gc.Equals, 5)
279251
}

0 commit comments

Comments
 (0)