Skip to content

Commit

Permalink
Revert "Cherry-pick 4564ec7 with conflicts resolved and focal stuff r…
Browse files Browse the repository at this point in the history
…emoved"

This reverts commit 7db4014.
  • Loading branch information
benhoyt committed Nov 16, 2020
1 parent 529aaf0 commit 75b733e
Show file tree
Hide file tree
Showing 22 changed files with 109 additions and 109 deletions.
9 changes: 5 additions & 4 deletions apiserver/facades/client/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/juju/errors"
"github.com/juju/loggo"
"github.com/juju/names/v4"
"github.com/juju/os/series"
"github.com/juju/replicaset"
jtesting "github.com/juju/testing"
jc "github.com/juju/testing/checkers"
Expand Down Expand Up @@ -1270,7 +1271,7 @@ func (s *clientSuite) TestClientAddMachinesDefaultSeries(c *gc.C) {
c.Assert(len(machines), gc.Equals, 3)
for i, machineResult := range machines {
c.Assert(machineResult.Machine, gc.DeepEquals, strconv.Itoa(i))
s.checkMachine(c, machineResult.Machine, jujuversion.DefaultSupportedLTS(), apiParams[i].Constraints.String())
s.checkMachine(c, machineResult.Machine, series.DefaultSupportedLTS(), apiParams[i].Constraints.String())
}
}

Expand All @@ -1286,7 +1287,7 @@ func (s *clientSuite) assertAddMachines(c *gc.C) {
c.Assert(len(machines), gc.Equals, 3)
for i, machineResult := range machines {
c.Assert(machineResult.Machine, gc.DeepEquals, strconv.Itoa(i))
s.checkMachine(c, machineResult.Machine, jujuversion.DefaultSupportedLTS(), apiParams[i].Constraints.String())
s.checkMachine(c, machineResult.Machine, series.DefaultSupportedLTS(), apiParams[i].Constraints.String())
}
}

Expand Down Expand Up @@ -1362,7 +1363,7 @@ func (s *clientSuite) TestClientAddMachinesWithConstraints(c *gc.C) {
c.Assert(len(machines), gc.Equals, 3)
for i, machineResult := range machines {
c.Assert(machineResult.Machine, gc.DeepEquals, strconv.Itoa(i))
s.checkMachine(c, machineResult.Machine, jujuversion.DefaultSupportedLTS(), apiParams[i].Constraints.String())
s.checkMachine(c, machineResult.Machine, series.DefaultSupportedLTS(), apiParams[i].Constraints.String())
}
}

Expand Down Expand Up @@ -1452,7 +1453,7 @@ func (s *clientSuite) TestClientAddMachinesWithInstanceIdSomeErrors(c *gc.C) {
c.Assert(machineResult.Error, gc.ErrorMatches, "cannot add a new machine: cannot add a machine with an instance id and no nonce")
} else {
c.Assert(machineResult.Machine, gc.DeepEquals, strconv.Itoa(i))
s.checkMachine(c, machineResult.Machine, jujuversion.DefaultSupportedLTS(), apiParams[i].Constraints.String())
s.checkMachine(c, machineResult.Machine, series.DefaultSupportedLTS(), apiParams[i].Constraints.String())
instanceId := fmt.Sprintf("1234-%d", i)
s.checkInstance(c, machineResult.Machine, instanceId, "foo", hc, network.NewSpaceAddresses("1.2.3.4"))
}
Expand Down
4 changes: 2 additions & 2 deletions apiserver/facades/client/modelmanager/modelinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/juju/description/v2"
"github.com/juju/errors"
"github.com/juju/names/v4"
"github.com/juju/os/series"
gitjujutesting "github.com/juju/testing"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
Expand All @@ -32,7 +33,6 @@ import (
"github.com/juju/juju/environs/context"
"github.com/juju/juju/state"
coretesting "github.com/juju/juju/testing"
"github.com/juju/juju/version"
)

type modelInfoSuite struct {
Expand Down Expand Up @@ -226,7 +226,7 @@ func (s *modelInfoSuite) expectedModelInfo(c *gc.C, credentialValidity *bool) pa
CloudTag: "cloud-some-cloud",
CloudRegion: "some-region",
CloudCredentialTag: "cloudcred-some-cloud_bob_some-credential",
DefaultSeries: version.DefaultSupportedLTS(),
DefaultSeries: series.DefaultSupportedLTS(),
Life: life.Dying,
Status: params.EntityStatus{
Status: status.Destroying,
Expand Down
21 changes: 10 additions & 11 deletions cmd/juju/application/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import (
"github.com/juju/juju/storage"
"github.com/juju/juju/testcharms"
coretesting "github.com/juju/juju/testing"
jujuversion "github.com/juju/juju/version"
)

// defaultSupportedJujuSeries is used to return canned information about what
Expand Down Expand Up @@ -355,7 +354,7 @@ func (s *DeploySuite) TestDeployFromPathOldCharmMissingSeries(c *gc.C) {

func (s *DeploySuite) TestDeployFromPathOldCharmMissingSeriesUseDefaultSeries(c *gc.C) {
charmDir := testcharms.RepoWithSeries("bionic").ClonedDir(c.MkDir(), "dummy")
curl := charm.MustParseURL(fmt.Sprintf("local:%s/dummy-1", jujuversion.DefaultSupportedLTS()))
curl := charm.MustParseURL(fmt.Sprintf("local:%s/dummy-1", series.DefaultSupportedLTS()))
withLocalCharmDeployable(s.fakeAPI, curl, charmDir, false)
withCharmDeployable(s.fakeAPI, curl, "bionic", charmDir.Meta(), charmDir.Metrics(), false, false, 1, nil, nil)

Expand Down Expand Up @@ -1132,7 +1131,7 @@ func (s *DeploySuite) TestDeployStorageFailContainer(c *gc.C) {
withLocalCharmDeployable(s.fakeAPI, curl, charmDir, false)
withCharmDeployable(s.fakeAPI, curl, "bionic", charmDir.Meta(), charmDir.Metrics(), false, false, 1, nil, nil)

machine, err := s.State.AddMachine(jujuversion.DefaultSupportedLTS(), state.JobHostUnits)
machine, err := s.State.AddMachine(series.DefaultSupportedLTS(), state.JobHostUnits)
c.Assert(err, jc.ErrorIsNil)
container := "lxd:" + machine.Id()
err = s.runDeploy(c, charmDir.Path, "--to", container, "--storage", "data=machinescoped,1G")
Expand All @@ -1145,7 +1144,7 @@ func (s *DeploySuite) TestPlacement(c *gc.C) {
withLocalCharmDeployable(s.fakeAPI, curl, charmDir, false)
withCharmDeployable(s.fakeAPI, curl, "bionic", charmDir.Meta(), charmDir.Metrics(), false, false, 1, nil, nil)
// Add a machine that will be ignored due to placement directive.
machine, err := s.State.AddMachine(jujuversion.DefaultSupportedLTS(), state.JobHostUnits)
machine, err := s.State.AddMachine(series.DefaultSupportedLTS(), state.JobHostUnits)
c.Assert(err, jc.ErrorIsNil)

err = s.runDeployForState(c, charmDir.Path, "-n", "1", "--to", "valid", "--series", "bionic")
Expand Down Expand Up @@ -1224,9 +1223,9 @@ func (s *DeploySuite) TestForceMachine(c *gc.C) {
withLocalCharmDeployable(s.fakeAPI, curl, charmDir, false)
withCharmDeployable(s.fakeAPI, curl, "bionic", charmDir.Meta(), charmDir.Metrics(), false, false, 1, nil, nil)

machine, err := s.State.AddMachine(jujuversion.DefaultSupportedLTS(), state.JobHostUnits)
machine, err := s.State.AddMachine(series.DefaultSupportedLTS(), state.JobHostUnits)
c.Assert(err, jc.ErrorIsNil)
err = s.runDeployForState(c, "--to", machine.Id(), charmDir.Path, "portlandia", "--series", jujuversion.DefaultSupportedLTS())
err = s.runDeployForState(c, "--to", machine.Id(), charmDir.Path, "portlandia", "--series", series.DefaultSupportedLTS())
c.Assert(err, jc.ErrorIsNil)
s.assertForceMachine(c, machine.Id())
}
Expand All @@ -1248,12 +1247,12 @@ func (s *DeploySuite) TestForceMachineExistingContainer(c *gc.C) {
withCharmDeployable(s.fakeAPI, curl, "bionic", charmDir.Meta(), charmDir.Metrics(), false, false, 1, nil, nil)

template := state.MachineTemplate{
Series: jujuversion.DefaultSupportedLTS(),
Series: series.DefaultSupportedLTS(),
Jobs: []state.MachineJob{state.JobHostUnits},
}
container, err := s.State.AddMachineInsideNewMachine(template, template, instance.LXD)
c.Assert(err, jc.ErrorIsNil)
err = s.runDeployForState(c, "--to", container.Id(), charmDir.Path, "portlandia", "--series", jujuversion.DefaultSupportedLTS())
err = s.runDeployForState(c, "--to", container.Id(), charmDir.Path, "portlandia", "--series", series.DefaultSupportedLTS())
c.Assert(err, jc.ErrorIsNil)
s.assertForceMachine(c, container.Id())
machines, err := s.State.AllMachines()
Expand All @@ -1265,10 +1264,10 @@ func (s *DeploySuite) TestForceMachineNewContainer(c *gc.C) {
charmDir := testcharms.RepoWithSeries("bionic").ClonedDir(c.MkDir(), "dummy")
curl := charm.MustParseURL("local:bionic/dummy-1")
withLocalCharmDeployable(s.fakeAPI, curl, charmDir, false)
ltsseries := jujuversion.DefaultSupportedLTS()
ltsseries := series.DefaultSupportedLTS()
withCharmDeployable(s.fakeAPI, curl, ltsseries, charmDir.Meta(), charmDir.Metrics(), false, false, 1, nil, nil)

machine, err := s.State.AddMachine(jujuversion.DefaultSupportedLTS(), state.JobHostUnits)
machine, err := s.State.AddMachine(series.DefaultSupportedLTS(), state.JobHostUnits)
c.Assert(err, jc.ErrorIsNil)
err = s.runDeployForState(c, "--to", "lxd:"+machine.Id(), charmDir.Path, "portlandia", "--series", ltsseries)
c.Assert(err, jc.ErrorIsNil)
Expand Down Expand Up @@ -1300,7 +1299,7 @@ func (s *DeploySuite) TestForceMachineNotFound(c *gc.C) {
}

func (s *DeploySuite) TestForceMachineSubordinate(c *gc.C) {
machine, err := s.State.AddMachine(jujuversion.DefaultSupportedLTS(), state.JobHostUnits)
machine, err := s.State.AddMachine(series.DefaultSupportedLTS(), state.JobHostUnits)
c.Assert(err, jc.ErrorIsNil)
charmDir := testcharms.RepoWithSeries("bionic").ClonedDir(c.MkDir(), "logging")
curl := charm.MustParseURL("local:bionic/logging-1")
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/commands/upgrademodel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ func (s *UpgradeBaseSuite) assertUpgradeTests(c *gc.C, tests []upgradeTest, upgr

for _, uploaded := range test.expectUploaded {
// Substitute latest LTS for placeholder in expected series for uploaded tools
uploaded = strings.Replace(uploaded, "%LTS%", jujuversion.DefaultSupportedLTS(), 1)
uploaded = strings.Replace(uploaded, "%LTS%", series.DefaultSupportedLTS(), 1)
vers := version.MustParseBinary(uploaded)
s.checkToolsUploaded(c, vers, agentVersion)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/plugins/juju-metadata/imagemetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/juju/cmd"
"github.com/juju/cmd/cmdtesting"
"github.com/juju/os/series"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

Expand All @@ -22,7 +23,6 @@ import (
"github.com/juju/juju/jujuclient/jujuclienttesting"
"github.com/juju/juju/provider/dummy"
"github.com/juju/juju/testing"
"github.com/juju/juju/version"
)

type ImageMetadataSuite struct {
Expand Down Expand Up @@ -171,7 +171,7 @@ func (s *ImageMetadataSuite) TestImageMetadataFilesLatestLTS(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
out := cmdtesting.Stdout(ctx)
expected := expectedMetadata{
series: version.DefaultSupportedLTS(),
series: series.DefaultSupportedLTS(),
arch: "arch",
}
s.assertCommandOutput(c, expected, out, defaultIndexFileName, defaultImageFileName)
Expand Down
10 changes: 5 additions & 5 deletions environs/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var (
// Ensure that we add the default supported series so that tests that
// use the default supported lts internally will always work in the
// future.
supportedJujuSeries = set.NewStrings("precise", "trusty", "quantal", "bionic", jujuversion.DefaultSupportedLTS())
supportedJujuSeries = set.NewStrings("precise", "trusty", "quantal", "bionic", series.DefaultSupportedLTS())
)

type bootstrapSuite struct {
Expand Down Expand Up @@ -221,7 +221,7 @@ func (s *bootstrapSuite) TestBootstrapFallbackBootstrapSeries(c *gc.C) {
env := newEnviron("foo", useDefaultKeys, nil)
s.setDummyStorage(c, env)
cfg, err := env.Config().Apply(map[string]interface{}{
"default-series": jujuversion.DefaultSupportedLTS(),
"default-series": series.DefaultSupportedLTS(),
})
c.Assert(err, jc.ErrorIsNil)
env.cfg = cfg
Expand All @@ -235,7 +235,7 @@ func (s *bootstrapSuite) TestBootstrapFallbackBootstrapSeries(c *gc.C) {
})
c.Assert(err, jc.ErrorIsNil)
c.Check(env.bootstrapCount, gc.Equals, 1)
c.Check(env.args.AvailableTools.AllSeries(), jc.SameContents, []string{jujuversion.DefaultSupportedLTS()})
c.Check(env.args.AvailableTools.AllSeries(), jc.SameContents, []string{series.DefaultSupportedLTS()})
}

func (s *bootstrapSuite) TestBootstrapForcedBootstrapSeries(c *gc.C) {
Expand Down Expand Up @@ -1365,7 +1365,7 @@ func (s *bootstrapSuite) setupBootstrapSpecificVersion(c *gc.C, clientMajor, cli
})
defer envtools.UnregisterToolsDataSourceFunc("local storage")

supportedSeries := jujuversion.DefaultSupportedLTS()
supportedSeries := series.DefaultSupportedLTS()
toolsBinaries := []version.Binary{
version.MustParseBinary(fmt.Sprintf("10.11.12-%s-amd64", supportedSeries)),
version.MustParseBinary(fmt.Sprintf("10.11.13-%s-amd64", supportedSeries)),
Expand Down Expand Up @@ -1608,7 +1608,7 @@ func (e *bootstrapEnviron) Bootstrap(ctx environs.BootstrapContext, callCtx cont
e.instanceConfig = icfg
return nil
}
series := jujuversion.DefaultSupportedLTS()
series := series.DefaultSupportedLTS()
if args.BootstrapSeries != "" {
series = args.BootstrapSeries
}
Expand Down
8 changes: 4 additions & 4 deletions environs/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/juju/loggo"
"github.com/juju/os/series"
"github.com/juju/proxy"
"github.com/juju/schema"
gitjujutesting "github.com/juju/testing"
Expand All @@ -21,7 +22,6 @@ import (
"github.com/juju/juju/environs/config"
"github.com/juju/juju/juju/osenv"
"github.com/juju/juju/testing"
jujuversion "github.com/juju/juju/version"
)

func Test(t *stdtesting.T) {
Expand Down Expand Up @@ -53,7 +53,7 @@ var sampleConfig = testing.Attrs{
"unknown": "my-unknown",
"ssl-hostname-verification": true,
"development": false,
"default-series": jujuversion.DefaultSupportedLTS(),
"default-series": series.DefaultSupportedLTS(),
"disable-network-management": false,
"ignore-machine-addresses": false,
"automatically-retry-hooks": true,
Expand Down Expand Up @@ -644,7 +644,7 @@ func (test configTest) check(c *gc.C, home *gitjujutesting.FakeHome) {
if seriesAttr != "" {
c.Assert(defaultSeries, gc.Equals, seriesAttr)
} else {
c.Assert(defaultSeries, gc.Equals, jujuversion.DefaultSupportedLTS())
c.Assert(defaultSeries, gc.Equals, series.DefaultSupportedLTS())
}

if m, _ := test.attrs["firewall-mode"].(string); m != "" {
Expand Down Expand Up @@ -794,7 +794,7 @@ func (s *ConfigSuite) TestConfigAttrs(c *gc.C) {
"firewall-mode": config.FwInstance,
"unknown": "my-unknown",
"ssl-hostname-verification": true,
"default-series": jujuversion.DefaultSupportedLTS(),
"default-series": series.DefaultSupportedLTS(),
"disable-network-management": false,
"ignore-machine-addresses": false,
"automatically-retry-hooks": true,
Expand Down
8 changes: 4 additions & 4 deletions environs/manual/sshprovisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"os"

"github.com/juju/os/series"
jc "github.com/juju/testing/checkers"
"github.com/juju/utils/shell"
"github.com/juju/version"
Expand All @@ -24,7 +25,6 @@ import (
envtesting "github.com/juju/juju/environs/testing"
envtools "github.com/juju/juju/environs/tools"
"github.com/juju/juju/juju/testing"
jujuversion "github.com/juju/juju/version"
)

type provisionerSuite struct {
Expand All @@ -46,7 +46,7 @@ func (s *provisionerSuite) getArgs(c *gc.C) manual.ProvisionMachineArgs {
}

func (s *provisionerSuite) TestProvisionMachine(c *gc.C) {
var series = jujuversion.DefaultSupportedLTS()
var series = series.DefaultSupportedLTS()
const arch = "amd64"

args := s.getArgs(c)
Expand Down Expand Up @@ -128,7 +128,7 @@ func (s *provisionerSuite) TestProvisionMachine(c *gc.C) {
}

func (s *provisionerSuite) TestFinishInstancConfig(c *gc.C) {
var series = jujuversion.DefaultSupportedLTS()
var series = series.DefaultSupportedLTS()
const arch = "amd64"
defer fakeSSH{
Series: series,
Expand All @@ -150,7 +150,7 @@ func (s *provisionerSuite) TestFinishInstancConfig(c *gc.C) {
}

func (s *provisionerSuite) TestProvisioningScript(c *gc.C) {
var series = jujuversion.DefaultSupportedLTS()
var series = series.DefaultSupportedLTS()
const arch = "amd64"
defer fakeSSH{
Series: series,
Expand Down
10 changes: 5 additions & 5 deletions provider/common/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func newStorage(suite cleaner, c *gc.C) storage.Storage {
}

func minimalConfig(c *gc.C) *config.Config {
return minimalConfigWithSeries(c, jujuversion.DefaultSupportedLTS())
return minimalConfigWithSeries(c, series.DefaultSupportedLTS())
}

func minimalConfigWithSeries(c *gc.C, series string) *config.Config {
Expand Down Expand Up @@ -169,7 +169,7 @@ func (s *BootstrapSuite) TestBootstrapSeries(c *gc.C) {
config: fakeMinimalConfig(c),
}
ctx := envtesting.BootstrapContext(c)
bootstrapSeries := jujuversion.DefaultSupportedLTS()
bootstrapSeries := series.DefaultSupportedLTS()
availableTools := fakeAvailableTools()
availableTools[0].Version.Series = bootstrapSeries
result, err := common.Bootstrap(ctx, env, s.callCtx, environs.BootstrapParams{
Expand Down Expand Up @@ -221,7 +221,7 @@ func (s *BootstrapSuite) TestBootstrapFallbackSeries(c *gc.C) {
})
c.Assert(err, jc.ErrorIsNil)
c.Check(result.Arch, gc.Equals, "ppc64el") // based on hardware characteristics
c.Check(result.Series, gc.Equals, jujuversion.DefaultSupportedLTS())
c.Check(result.Series, gc.Equals, series.DefaultSupportedLTS())
}

func (s *BootstrapSuite) TestBootstrapSeriesWithForce(c *gc.C) {
Expand Down Expand Up @@ -642,7 +642,7 @@ func (s *BootstrapSuite) TestBootstrapFinalizeCloudInitUserData(c *gc.C) {
},
}
ctx := envtesting.BootstrapContext(c)
bootstrapSeries := jujuversion.DefaultSupportedLTS()
bootstrapSeries := series.DefaultSupportedLTS()
availableTools := fakeAvailableTools()
availableTools[0].Version.Series = bootstrapSeries
result, err := common.Bootstrap(ctx, env, s.callCtx, environs.BootstrapParams{
Expand Down Expand Up @@ -928,7 +928,7 @@ func fakeAvailableTools() tools.List {
Version: version.Binary{
Number: jujuversion.Current,
Arch: arch.HostArch(),
Series: jujuversion.DefaultSupportedLTS(),
Series: series.DefaultSupportedLTS(),
},
},
}
Expand Down
9 changes: 4 additions & 5 deletions provider/ec2/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/juju/juju/environs/imagemetadata"
"github.com/juju/juju/environs/instances"
"github.com/juju/juju/testing"
"github.com/juju/juju/version"
)

var _ = gc.Suite(&specSuite{})
Expand Down Expand Up @@ -260,7 +259,7 @@ func (s *specSuite) TestFindInstanceSpec(c *gc.C) {
func (s *specSuite) TestFindInstanceSpecNotSetCpuPowerWhenInstanceTypeSet(c *gc.C) {
instanceConstraint := &instances.InstanceConstraint{
Region: "test",
Series: version.DefaultSupportedLTS(),
Series: series.DefaultSupportedLTS(),
Constraints: constraints.MustParse("instance-type=t2.medium"),
}

Expand All @@ -283,16 +282,16 @@ var findInstanceSpecErrorTests = []struct {
err string
}{
{
series: version.DefaultSupportedLTS(),
series: series.DefaultSupportedLTS(),
arches: []string{"arm"},
err: fmt.Sprintf(`no "%s" images in test with arches \[arm\]`, version.DefaultSupportedLTS()),
err: fmt.Sprintf(`no metadata for "%s" images in test with arches \[arm\]`, series.DefaultSupportedLTS()),
}, {
series: "raring",
arches: []string{"amd64", "i386"},
cons: "mem=4G",
err: `no "raring" images in test matching instance types \[.*\]`,
}, {
series: version.DefaultSupportedLTS(),
series: series.DefaultSupportedLTS(),
arches: []string{"amd64"},
cons: "instance-type=m1.small mem=4G",
err: `no instance types in test matching constraints "instance-type=m1.small mem=4096M"`,
Expand Down
Loading

0 comments on commit 75b733e

Please sign in to comment.