Skip to content

Commit

Permalink
Delete dead/unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
axw committed Jun 13, 2017
1 parent 1cb9c09 commit cc4d9c2
Show file tree
Hide file tree
Showing 148 changed files with 16 additions and 2,446 deletions.
14 changes: 0 additions & 14 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,6 @@ func (s APIHostPortsSetter) SetAPIHostPorts(servers [][]network.HostPort) error
})
}

// StateServingInfoSetter trivially wraps an Agent to implement
// worker/certupdater/SetStateServingInfo.
type StateServingInfoSetter struct {
Agent
}

// SetStateServingInfo is the SetStateServingInfo interface.
func (s StateServingInfoSetter) SetStateServingInfo(info params.StateServingInfo) error {
return s.ChangeConfig(func(c ConfigSetter) error {
c.SetStateServingInfo(info)
return nil
})
}

// Paths holds the directory paths used by the agent.
type Paths struct {
// DataDir is the data directory where each agent has a subdirectory
Expand Down
44 changes: 0 additions & 44 deletions agent/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,6 @@

package agent

import (
"fmt"
"os"

"github.com/juju/juju/state/multiwatcher"
)

func PatchConfig(config Config, fieldName string, value interface{}) error {
conf := config.(*configInternal)
switch fieldName {
case "Paths":
paths := value.(Paths)
if paths.DataDir != "" {
conf.paths.DataDir = paths.DataDir
}
if paths.LogDir != "" {
conf.paths.LogDir = paths.LogDir
}
case "Jobs":
conf.jobs = value.([]multiwatcher.MachineJob)[:]
case "DeleteValues":
for _, key := range value.([]string) {
delete(conf.values, key)
}
case "Values":
for key, val := range value.(map[string]string) {
if conf.values == nil {
conf.values = make(map[string]string)
}
conf.values[key] = val
}
default:
return fmt.Errorf("unknown field %q", fieldName)
}
conf.configFilePath = ConfigPath(conf.paths.DataDir, conf.tag)
return nil
}

func ConfigFileExists(config Config) bool {
conf := config.(*configInternal)
_, err := os.Lstat(conf.configFilePath)
return err == nil
}

func EmptyConfig() Config {
return &configInternal{}
}
15 changes: 0 additions & 15 deletions api/application/export_test.go

This file was deleted.

6 changes: 0 additions & 6 deletions api/backups/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/backups"
apiserverbackups "github.com/juju/juju/apiserver/backups"
"github.com/juju/juju/apiserver/params"
jujutesting "github.com/juju/juju/juju/testing"
stbackups "github.com/juju/juju/state/backups"
Expand All @@ -30,11 +29,6 @@ func (s *baseSuite) SetUpTest(c *gc.C) {
s.client = client
}

func (s *baseSuite) metadataResult() *params.BackupsMetadataResult {
result := apiserverbackups.ResultFromMetadata(s.Meta)
return &result
}

func (s *baseSuite) checkMetadataResult(c *gc.C, result *params.BackupsMetadataResult, meta *stbackups.Metadata) {
var finished, stored time.Time
if meta.Finished != nil {
Expand Down
15 changes: 0 additions & 15 deletions api/meterstatus/export_test.go

This file was deleted.

5 changes: 0 additions & 5 deletions api/uniter/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ func PatchUnitResponse(p testing.Patcher, u *Unit, expectedRequest string, respo
})
}

// PatchUnitFacadeCall changes the internal FacadeCaller to one that calls the provided request handler function.
func PatchUnitFacadeCall(p testing.Patcher, u *Unit, respFunc func(request string, params, response interface{}) error) {
testing.PatchFacadeCall(p, &u.st.facade, respFunc)
}

// CreateUnit creates uniter.Unit for tests.
func CreateUnit(st *State, tag names.UnitTag) *Unit {
return &Unit{st, tag, params.Alive}
Expand Down
11 changes: 0 additions & 11 deletions api/uniter/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"gopkg.in/juju/names.v2"

"github.com/juju/juju/api"
"github.com/juju/juju/api/base"
"github.com/juju/juju/api/uniter"
"github.com/juju/juju/apiserver/common"
"github.com/juju/juju/apiserver/params"
Expand Down Expand Up @@ -825,16 +824,6 @@ func (s *unitSuite) TestWatchMeterStatus(c *gc.C) {
wc.AssertOneChange()
}

func (s *unitSuite) patchNewState(
c *gc.C,
patchFunc func(_ base.APICaller, _ names.UnitTag) *uniter.State,
) {
s.uniterSuite.patchNewState(c, patchFunc)
var err error
s.apiUnit, err = s.uniter.Unit(s.wordpressUnit.Tag().(names.UnitTag))
c.Assert(err, jc.ErrorIsNil)
}

type unitMetricBatchesSuite struct {
testing.JujuConnSuite

Expand Down
13 changes: 0 additions & 13 deletions api/uniter/uniter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import (
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
gc "gopkg.in/check.v1"
"gopkg.in/juju/names.v2"

"github.com/juju/juju/api"
"github.com/juju/juju/api/base"
"github.com/juju/juju/api/uniter"
"github.com/juju/juju/juju/testing"
"github.com/juju/juju/state"
Expand Down Expand Up @@ -122,17 +120,6 @@ func (s *uniterSuite) assertInScope(c *gc.C, relUnit *state.RelationUnit, inScop
c.Assert(ok, gc.Equals, inScope)
}

func (s *uniterSuite) patchNewState(
c *gc.C,
patchFunc func(_ base.APICaller, _ names.UnitTag) *uniter.State,
) {
s.PatchValue(&uniter.NewState, patchFunc)
var err error
s.uniter, err = s.st.Uniter()
c.Assert(err, jc.ErrorIsNil)
c.Assert(s.uniter, gc.NotNil)
}

func (s *uniterSuite) TestSLALevel(c *gc.C) {
err := s.State.SetSLA("essential", "bob", []byte("creds"))
c.Assert(err, jc.ErrorIsNil)
Expand Down
20 changes: 0 additions & 20 deletions apiserver/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,26 +161,6 @@ func (s *loginSuite) TestLoginAsDeactivatedUser(c *gc.C) {
})
}

func (s *baseLoginSuite) runLoginSetsLogIdentifier(c *gc.C) {
info, srv := newServer(c, s.State)
defer assertStop(c, srv)

machine, password := s.Factory.MakeMachineReturningPassword(
c, &factory.MachineParams{Nonce: "fake_nonce"})

info.Tag = machine.Tag()
info.Password = password
info.Nonce = "fake_nonce"

apiConn, err := api.Open(info, fastDialOpts)
c.Assert(err, jc.ErrorIsNil)
defer apiConn.Close()

apiMachine, err := apimachiner.NewState(apiConn).Machine(machine.MachineTag())
c.Assert(err, jc.ErrorIsNil)
c.Assert(apiMachine.Tag(), gc.Equals, machine.Tag())
}

func (s *loginSuite) TestLoginAddrs(c *gc.C) {
info, srv := s.newMachineAndServer(c)
defer assertStop(c, srv)
Expand Down
19 changes: 0 additions & 19 deletions apiserver/application/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package application

import (
"github.com/juju/errors"
"gopkg.in/juju/charm.v6-unstable"
csparams "gopkg.in/juju/charmrepo.v2-unstable/csclient/params"
"gopkg.in/juju/names.v2"
Expand Down Expand Up @@ -266,35 +265,17 @@ type Subnet interface {
VLANTag() int
ProviderId() network.Id
ProviderNetworkId() network.Id
AvailabilityZones() []string
}

type subnetShim struct {
*state.Subnet
}

func (s *subnetShim) AvailabilityZones() []string {
return []string{s.Subnet.AvailabilityZone()}
}

type Space interface {
Name() string
Subnets() ([]Subnet, error)
ProviderId() network.Id
}

type spaceShim struct {
*state.Space
}

func (s *spaceShim) Subnets() ([]Subnet, error) {
subnets, err := s.Space.Subnets()
if err != nil {
return nil, errors.Trace(err)
}
result := make([]Subnet, len(subnets))
for i, subnet := range subnets {
result[i] = &subnetShim{subnet}
}
return result, nil
}
7 changes: 0 additions & 7 deletions apiserver/application/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@

package application

import "github.com/juju/errors"

var (
ParseSettingsCompatible = parseSettingsCompatible
NewStateStorage = &newStateStorage
)

func IsMinJujuVersionError(err error) bool {
_, ok := errors.Cause(err).(minJujuVersionErr)
return ok
}
32 changes: 0 additions & 32 deletions apiserver/application/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ type mockModel struct {
owner string
}

func (m *mockModel) UUID() string {
return m.uuid
}

func (m *mockModel) ModelTag() names.ModelTag {
return names.NewModelTag(m.uuid)
}
Expand Down Expand Up @@ -190,10 +186,6 @@ func (m *mockSpace) Name() string {
return m.name
}

func (m *mockSpace) Subnets() ([]application.Subnet, error) {
return m.subnets, nil
}

func (m *mockSpace) ProviderId() network.Id {
return m.providerId
}
Expand Down Expand Up @@ -222,18 +214,6 @@ func (m *mockSubnet) ProviderNetworkId() network.Id {
return m.providerNetworkId
}

func (m *mockSubnet) AvailabilityZones() []string {
return m.zones
}

type mockConnectionStatus struct {
count int
}

func (m *mockConnectionStatus) ConnectionCount() int {
return m.count
}

type mockBackend struct {
jtesting.Stub
application.Backend
Expand Down Expand Up @@ -445,18 +425,6 @@ func (m *mockBackend) AllModels() ([]application.Model, error) {
return []application.Model{m.model}, nil
}

type mockStatePool struct {
st map[string]application.Backend
}

func (st *mockStatePool) Get(modelUUID string) (application.Backend, func(), error) {
backend, ok := st.st[modelUUID]
if !ok {
return nil, nil, errors.NotFoundf("model for uuid %s", modelUUID)
}
return backend, func() {}, nil
}

type mockBlockChecker struct {
jtesting.Stub
}
Expand Down
22 changes: 0 additions & 22 deletions apiserver/client/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

jc "github.com/juju/testing/checkers"
"github.com/juju/utils/clock"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v6-unstable"
"gopkg.in/juju/names.v2"
Expand All @@ -22,7 +21,6 @@ import (
"github.com/juju/juju/feature"
"github.com/juju/juju/instance"
"github.com/juju/juju/juju/testing"
"github.com/juju/juju/mongo"
"github.com/juju/juju/state"
"github.com/juju/juju/state/multiwatcher"
"github.com/juju/juju/state/presence"
Expand Down Expand Up @@ -77,26 +75,6 @@ func setDefaultStatus(c *gc.C, entity setStatuser) {
c.Assert(err, jc.ErrorIsNil)
}

func (s *baseSuite) tryOpenState(c *gc.C, e apiAuthenticator, password string) error {
stateInfo := s.MongoInfo(c)
stateInfo.Tag = e.Tag()
stateInfo.Password = password
st, err := state.Open(state.OpenParams{
Clock: clock.WallClock,
ControllerTag: s.State.ControllerTag(),
ControllerModelTag: s.State.ModelTag(),
MongoInfo: stateInfo,
MongoDialOpts: mongo.DialOpts{
Timeout: 25 * time.Millisecond,
},
})

if err == nil {
st.Close()
}
return err
}

// openAs connects to the API state as the given entity
// with the default password for that entity.
func (s *baseSuite) openAs(c *gc.C, tag names.Tag) api.Connection {
Expand Down
Loading

0 comments on commit cc4d9c2

Please sign in to comment.