Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Added functionality for environment variables in SNAP_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
kjlyon committed Sep 7, 2016
1 parent f3cd21f commit fe99808
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion control/fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

var (
PluginName = "snap-plugin-collector-mock2"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
PluginPath = path.Join(SnapPath, "plugin", PluginName)

JSONRPCPluginName = "snap-plugin-collector-mock1"
Expand Down
24 changes: 12 additions & 12 deletions control/subscription_group_medium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func TestSubscriptionGroups_ProcessStaticNegative(t *testing.T) {
c.Start()

Convey("Loading a mock collector plugn", t, func() {
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
<-lpe.load

Expand Down Expand Up @@ -162,7 +162,7 @@ func TestSubscriptionGroups_ProcessStaticNegative(t *testing.T) {
config: cdata.NewNode(),
}

_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-anothermock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-anothermock1"))
So(err, ShouldBeNil)
<-lpe.load
serrs := sg.Process()
Expand Down Expand Up @@ -191,7 +191,7 @@ func TestSubscriptionGroups_ProcessStaticPositive(t *testing.T) {
c.Start()

Convey("Loading a mock collector plugn", t, func() {
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
<-lpe.load

Expand Down Expand Up @@ -224,7 +224,7 @@ func TestSubscriptionGroups_ProcessStaticPositive(t *testing.T) {
version: 2,
config: cdata.NewNode(),
}
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock2"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock2"))
So(err, ShouldBeNil)
<-lpe.load
serrs := sg.Process()
Expand Down Expand Up @@ -253,7 +253,7 @@ func TestSubscriptionGroups_ProcessDynamicPositive(t *testing.T) {
c.Start()

Convey("Loading a mock collector plugn", t, func() {
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
<-lpe.load

Expand Down Expand Up @@ -287,7 +287,7 @@ func TestSubscriptionGroups_ProcessDynamicPositive(t *testing.T) {
version: 1,
config: cdata.NewNode(),
}
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-anothermock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-anothermock1"))
So(err, ShouldBeNil)
<-lpe.load
serrs := sg.Process()
Expand Down Expand Up @@ -318,7 +318,7 @@ func TestSubscriptionGroups_ProcessDynamicNegative(t *testing.T) {
c.Start()

Convey("Loading a mock collector plugn", t, func() {
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
<-lpe.load

Expand Down Expand Up @@ -352,7 +352,7 @@ func TestSubscriptionGroups_ProcessDynamicNegative(t *testing.T) {
version: 1,
config: cdata.NewNode(),
}
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-anothermock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-anothermock1"))
So(err, ShouldBeNil)
<-lpe.load
serrs := sg.Process()
Expand Down Expand Up @@ -383,7 +383,7 @@ func TestSubscriptionGroups_AddRemoveStatic(t *testing.T) {
c.Start()

Convey("Loading a mock collector plugn", t, func() {
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
<-lpe.load

Expand Down Expand Up @@ -422,7 +422,7 @@ func TestSubscriptionGroups_AddRemoveDynamic(t *testing.T) {
c.Start()

Convey("Loading a mock collector plugn", t, func() {
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
<-lpe.load

Expand Down Expand Up @@ -464,7 +464,7 @@ func TestSubscriptionGroups_GetStatic(t *testing.T) {
c.Start()

Convey("Loading a mock collector plugn", t, func() {
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
<-lpe.load

Expand Down Expand Up @@ -509,7 +509,7 @@ func TestSubscriptionGroups_GetDynamic(t *testing.T) {
c.Start()

Convey("Loading a mock collector plugn", t, func() {
_, err := loadPlg(c, path.Join(os.Getenv("SNAP_PATH"), "plugin", "snap-plugin-collector-mock1"))
_, err := loadPlg(c, path.Join(os.ExpandEnv(os.Getenv("SNAP_PATH")), "plugin", "snap-plugin-collector-mock1"))
So(err, ShouldBeNil)
<-lpe.load

Expand Down
2 changes: 1 addition & 1 deletion core/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

var (
PluginName = "snap-plugin-collector-mock1"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
PluginPath = path.Join(SnapPath, "plugin", PluginName)
SignatureFile = path.Join(SnapPath, "../pkg/psigning", "snap-plugin-collector-mock1.asc")
)
Expand Down
2 changes: 1 addition & 1 deletion mgmt/rest/client/client_func_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var (
// Change to set the REST API logging to debug
LOG_LEVEL = log.FatalLevel

SNAP_PATH = os.Getenv("SNAP_PATH")
SNAP_PATH = os.ExpandEnv(os.Getenv("SNAP_PATH"))
MOCK_PLUGIN_PATH1 = []string{SNAP_PATH + "/plugin/snap-plugin-collector-mock1"}
MOCK_PLUGIN_PATH2 = []string{SNAP_PATH + "/plugin/snap-plugin-collector-mock2"}
ANOTHERMOCK_PLUGIN_PATH = []string{SNAP_PATH + "/plugin/snap-plugin-collector-anothermock1"}
Expand Down
2 changes: 1 addition & 1 deletion mgmt/rest/rest_func_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var (
// Switching this turns on logging for all the REST API calls
LOG_LEVEL = log.WarnLevel

SNAP_PATH = os.Getenv("SNAP_PATH")
SNAP_PATH = os.ExpandEnv(os.Getenv("SNAP_PATH"))
SNAP_AUTODISCOVER_PATH = os.Getenv("SNAP_AUTODISCOVER_PATH")
MOCK_PLUGIN_PATH1 = SNAP_PATH + "/plugin/snap-plugin-collector-mock1"
MOCK_PLUGIN_PATH2 = SNAP_PATH + "/plugin/snap-plugin-collector-mock2"
Expand Down
2 changes: 1 addition & 1 deletion pkg/psigning/psigning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestValidateSignature(t *testing.T) {
keyringFile := []string{"pubring.gpg"}
signedFile := "snap-plugin-collector-mock1"
signatureFile := signedFile + ".asc"
snapPath := os.Getenv("SNAP_PATH")
snapPath := os.ExpandEnv(os.Getenv("SNAP_PATH"))
unsignedFile := path.Join(snapPath, "plugin", "snap-plugin-collector-mock2")
s := SigningManager{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
var (
PluginName = "snap-plugin-collector-anothermock1"
PluginType = "collector"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
PluginPath = path.Join(SnapPath, "plugin", PluginName)
)

Expand Down
2 changes: 1 addition & 1 deletion plugin/collector/snap-plugin-collector-mock1/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
var (
PluginName = "snap-plugin-collector-mock1"
PluginType = "collector"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
PluginPath = path.Join(SnapPath, "plugin", PluginName)
)

Expand Down
2 changes: 1 addition & 1 deletion plugin/collector/snap-plugin-collector-mock2/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
var (
PluginName = "snap-plugin-collector-mock2"
PluginType = "collector"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
PluginPath = path.Join(SnapPath, "plugin", PluginName)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
var (
PluginName = "snap-plugin-publisher-mock-file"
PluginType = "publisher"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
PluginPath = path.Join(SnapPath, "plugin", PluginName)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
var (
PluginName = "snap-plugin-publisher-mock-file"
PluginType = "publisher"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
PluginPath = path.Join(SnapPath, "plugin", PluginName)
)

Expand Down
2 changes: 1 addition & 1 deletion scheduler/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
)

var (
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.ExpandEnv(os.Getenv("SNAP_PATH"))
snap_collector_mock1_path = path.Join(SnapPath, "plugin", "snap-plugin-collector-mock1")
snap_collector_mock2_path = path.Join(SnapPath, "plugin", "snap-plugin-collector-mock2")
snap_processor_passthru_path = path.Join(SnapPath, "plugin", "snap-plugin-processor-passthru")
Expand Down

0 comments on commit fe99808

Please sign in to comment.