Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to pass config file to grpc plugin in integration tests #3253

Merged
merged 2 commits into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions plugin/storage/integration/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,27 @@ type GRPCStorageIntegrationTestSuite struct {
StorageIntegration
logger *zap.Logger
pluginBinaryPath string
pluginConfigPath string
}

func (s *GRPCStorageIntegrationTestSuite) initialize() error {
s.logger, _ = testutils.NewLogger()

f := grpc.NewFactory()
v, command := config.Viperize(f.AddFlags)
err := command.ParseFlags([]string{
flags := []string{
"--grpc-storage-plugin.binary",
s.pluginBinaryPath,
"--grpc-storage-plugin.log-level",
"debug",
})
}
if s.pluginConfigPath != "" {
flags = append(flags,
"--grpc-storage-plugin.configuration-file",
s.pluginConfigPath,
)
}
err := command.ParseFlags(flags)
if err != nil {
return err
}
Expand Down Expand Up @@ -81,13 +89,18 @@ func TestGRPCStorage(t *testing.T) {
if os.Getenv("STORAGE") != "grpc-plugin" {
t.Skip("Integration test against grpc skipped; set STORAGE env var to grpc-plugin to run this")
}
path := os.Getenv("PLUGIN_BINARY_PATH")
if path == "" {
binaryPath := os.Getenv("PLUGIN_BINARY_PATH")
if binaryPath == "" {
t.Logf("PLUGIN_BINARY_PATH env var not set, using %s", defaultPluginBinaryPath)
path = defaultPluginBinaryPath
binaryPath = defaultPluginBinaryPath
}
configPath := os.Getenv("PLUGIN_CONFIG_PATH")
if configPath == "" {
t.Log("PLUGIN_CONFIG_PATH env var not set")
}
s := &GRPCStorageIntegrationTestSuite{
pluginBinaryPath: path,
pluginBinaryPath: binaryPath,
pluginConfigPath: configPath,
}
require.NoError(t, s.initialize())
s.IntegrationTestAll(t)
Expand Down