mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-10 02:11:11 +01:00
* license: update headers to IBM Corp. * `make proto` * update offset because source file changed Signed-off-by: Ryan Cragun <me@ryan.ec> Co-authored-by: Ryan Cragun <me@ryan.ec>
65 lines
779 B
Go
65 lines
779 B
Go
// Copyright IBM Corp. 2016, 2025
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package pluginutil
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestGRPCSupport(t *testing.T) {
|
|
cases := []struct {
|
|
envVersion string
|
|
expected bool
|
|
}{
|
|
{
|
|
"0.8.3",
|
|
false,
|
|
},
|
|
{
|
|
"0.9.2",
|
|
false,
|
|
},
|
|
{
|
|
"0.9.3",
|
|
false,
|
|
},
|
|
{
|
|
"0.9.4+ent",
|
|
true,
|
|
},
|
|
{
|
|
"0.9.4-beta",
|
|
false,
|
|
},
|
|
{
|
|
"0.9.4",
|
|
true,
|
|
},
|
|
{
|
|
"unknown",
|
|
true,
|
|
},
|
|
{
|
|
"",
|
|
false,
|
|
},
|
|
}
|
|
|
|
for _, tc := range cases {
|
|
t.Run(tc.envVersion, func(t *testing.T) {
|
|
err := os.Setenv(PluginVaultVersionEnv, tc.envVersion)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
result := GRPCSupport()
|
|
|
|
if result != tc.expected {
|
|
t.Fatalf("got: %t, expected: %t", result, tc.expected)
|
|
}
|
|
})
|
|
}
|
|
}
|