-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #497 from newrelic/chore/schema-updates
chore(install): make schema updates, fix bugs from previous validation PR
- Loading branch information
Showing
22 changed files
with
551 additions
and
220 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
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
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,26 @@ | ||
package install | ||
|
||
type installContext struct { | ||
specifyActions bool | ||
interactiveMode bool | ||
installLogging bool | ||
installInfraAgent bool | ||
recipeNames []string | ||
recipeFilenames []string | ||
} | ||
|
||
func (i *installContext) ShouldInstallInfraAgent() bool { | ||
return !i.RecipeFilenamesProvided() && (!i.specifyActions || i.installInfraAgent) | ||
} | ||
|
||
func (i *installContext) ShouldInstallLogging() bool { | ||
return !i.RecipeFilenamesProvided() && (!i.specifyActions || i.installLogging) | ||
} | ||
|
||
func (i *installContext) RecipeFilenamesProvided() bool { | ||
return len(i.recipeFilenames) > 0 | ||
} | ||
|
||
func (i *installContext) RecipeNamesProvided() bool { | ||
return len(i.recipeNames) > 0 | ||
} |
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,72 @@ | ||
package install | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestShouldInstallInfraAgent_Default(t *testing.T) { | ||
ic := installContext{} | ||
require.True(t, ic.ShouldInstallInfraAgent()) | ||
} | ||
|
||
func TestShouldInstallInfraAgent_SpecifyActions(t *testing.T) { | ||
ic := installContext{ | ||
specifyActions: true, | ||
} | ||
require.False(t, ic.ShouldInstallInfraAgent()) | ||
|
||
ic.installInfraAgent = true | ||
require.True(t, ic.ShouldInstallInfraAgent()) | ||
} | ||
|
||
func TestShouldInstallInfraAgent_RecipeFilenamesProvided(t *testing.T) { | ||
ic := installContext{ | ||
recipeFilenames: []string{"testFilename"}, | ||
} | ||
require.False(t, ic.ShouldInstallInfraAgent()) | ||
|
||
ic.installInfraAgent = true | ||
require.False(t, ic.ShouldInstallInfraAgent()) | ||
} | ||
func TestShouldInstallLogging_Default(t *testing.T) { | ||
ic := installContext{} | ||
require.True(t, ic.ShouldInstallLogging()) | ||
} | ||
|
||
func TestShouldInstallLogging_SpecifyActions(t *testing.T) { | ||
ic := installContext{ | ||
specifyActions: true, | ||
} | ||
require.False(t, ic.ShouldInstallLogging()) | ||
|
||
ic.installLogging = true | ||
require.True(t, ic.ShouldInstallLogging()) | ||
} | ||
|
||
func TestShouldInstallLogging_RecipeFilenamesProvided(t *testing.T) { | ||
ic := installContext{ | ||
recipeFilenames: []string{"testFilename"}, | ||
} | ||
require.False(t, ic.ShouldInstallLogging()) | ||
|
||
ic.installInfraAgent = true | ||
require.False(t, ic.ShouldInstallLogging()) | ||
} | ||
|
||
func TestRecipeNamesProvided(t *testing.T) { | ||
ic := installContext{} | ||
require.False(t, ic.RecipeNamesProvided()) | ||
|
||
ic.recipeNames = []string{"testName"} | ||
require.True(t, ic.RecipeNamesProvided()) | ||
} | ||
|
||
func TestRecipeFilenamesProvided(t *testing.T) { | ||
ic := installContext{} | ||
require.False(t, ic.RecipeFilenamesProvided()) | ||
|
||
ic.recipeFilenames = []string{"testFilename"} | ||
require.True(t, ic.RecipeFilenamesProvided()) | ||
} |
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
Oops, something went wrong.