mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 18:42:27 +08:00
Fix back-end tests on Windows (#26355)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/api/dtos"
|
"github.com/grafana/grafana/pkg/api/dtos"
|
||||||
@ -1002,7 +1003,7 @@ func TestDashboardApiEndpoint(t *testing.T) {
|
|||||||
dash := GetDashboardShouldReturn200WithConfig(sc, mock)
|
dash := GetDashboardShouldReturn200WithConfig(sc, mock)
|
||||||
|
|
||||||
Convey("Should return relative path to provisioning file", func() {
|
Convey("Should return relative path to provisioning file", func() {
|
||||||
So(dash.Meta.ProvisionedExternalId, ShouldEqual, "test/dashboard1.json")
|
So(dash.Meta.ProvisionedExternalId, ShouldEqual, filepath.Join("test", "dashboard1.json"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/infra/log"
|
"github.com/grafana/grafana/pkg/infra/log"
|
||||||
"github.com/grafana/grafana/pkg/util/errutil"
|
"github.com/grafana/grafana/pkg/util/errutil"
|
||||||
@ -85,7 +85,7 @@ func readPluginManifest(body []byte) (*pluginManifest, error) {
|
|||||||
// getPluginSignatureState returns the signature state for a plugin.
|
// getPluginSignatureState returns the signature state for a plugin.
|
||||||
func getPluginSignatureState(log log.Logger, plugin *PluginBase) PluginSignature {
|
func getPluginSignatureState(log log.Logger, plugin *PluginBase) PluginSignature {
|
||||||
log.Debug("Getting signature state of plugin", "plugin", plugin.Id)
|
log.Debug("Getting signature state of plugin", "plugin", plugin.Id)
|
||||||
manifestPath := path.Join(plugin.PluginDir, "MANIFEST.txt")
|
manifestPath := filepath.Join(plugin.PluginDir, "MANIFEST.txt")
|
||||||
|
|
||||||
byteValue, err := ioutil.ReadFile(manifestPath)
|
byteValue, err := ioutil.ReadFile(manifestPath)
|
||||||
if err != nil || len(byteValue) < 10 {
|
if err != nil || len(byteValue) < 10 {
|
||||||
@ -106,7 +106,7 @@ func getPluginSignatureState(log log.Logger, plugin *PluginBase) PluginSignature
|
|||||||
log.Debug("Verifying contents of plugin manifest", "plugin", plugin.Id)
|
log.Debug("Verifying contents of plugin manifest", "plugin", plugin.Id)
|
||||||
for p, hash := range manifest.Files {
|
for p, hash := range manifest.Files {
|
||||||
// Open the file
|
// Open the file
|
||||||
fp := path.Join(plugin.PluginDir, p)
|
fp := filepath.Join(plugin.PluginDir, p)
|
||||||
f, err := os.Open(fp)
|
f, err := os.Open(fp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return PluginSignatureModified
|
return PluginSignatureModified
|
||||||
|
@ -160,7 +160,7 @@ func TestPluginManager_Init(t *testing.T) {
|
|||||||
err := pm.Init()
|
err := pm.Init()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.Empty(t, pm.scanningErrors)
|
require.Empty(t, pm.scanningErrors)
|
||||||
assert.Equal(t, []string{"gel"}, fm.registeredPlugins)
|
assert.Equal(t, []string{"gel"}, fm.registeredPlugins)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user