37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package workloadattestor_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/spiffe/spire-plugin-sdk/pluginsdk"
|
|
"github.com/spiffe/spire-plugin-sdk/plugintest"
|
|
workloadattestorv1 "github.com/spiffe/spire-plugin-sdk/proto/spire/plugin/agent/workloadattestor/v1"
|
|
configv1 "github.com/spiffe/spire-plugin-sdk/proto/spire/service/common/config/v1"
|
|
"github.com/spiffe/spire-plugin-sdk/templates/agent/workloadattestor"
|
|
)
|
|
|
|
func Test(t *testing.T) {
|
|
plugin := new(workloadattestor.Plugin)
|
|
waClient := new(workloadattestorv1.WorkloadAttestorPluginClient)
|
|
configClient := new(configv1.ConfigServiceClient)
|
|
|
|
// Serve the plugin in the background with the configured plugin and
|
|
// service servers. The servers will be cleaned up when the test finishes.
|
|
// TODO: Remove the config service server and client if no configuration
|
|
// is required.
|
|
// TODO: Provide host service server implementations if required by the
|
|
// plugin.
|
|
plugintest.ServeInBackground(t, plugintest.Config{
|
|
PluginServer: workloadattestorv1.WorkloadAttestorPluginServer(plugin),
|
|
PluginClient: waClient,
|
|
ServiceServers: []pluginsdk.ServiceServer{
|
|
configv1.ConfigServiceServer(plugin),
|
|
},
|
|
ServiceClients: []pluginsdk.ServiceClient{
|
|
configClient,
|
|
},
|
|
})
|
|
|
|
// TODO: Invoke methods on the clients and assert the results
|
|
}
|