Fix back-end tests on Windows (#26355)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen 2020-07-15 20:09:03 +02:00 committed by GitHub
parent 5046e54918
commit 5fe27ee959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"path/filepath"
"testing"
"github.com/grafana/grafana/pkg/api/dtos"
@ -1002,7 +1003,7 @@ func TestDashboardApiEndpoint(t *testing.T) {
dash := GetDashboardShouldReturn200WithConfig(sc, mock)
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"))
})
})

View File

@ -9,7 +9,7 @@ import (
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"github.com/grafana/grafana/pkg/infra/log"
"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.
func getPluginSignatureState(log log.Logger, plugin *PluginBase) PluginSignature {
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)
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)
for p, hash := range manifest.Files {
// Open the file
fp := path.Join(plugin.PluginDir, p)
fp := filepath.Join(plugin.PluginDir, p)
f, err := os.Open(fp)
if err != nil {
return PluginSignatureModified

View File

@ -160,7 +160,7 @@ func TestPluginManager_Init(t *testing.T) {
err := pm.Init()
require.NoError(t, err)
assert.Empty(t, pm.scanningErrors)
require.Empty(t, pm.scanningErrors)
assert.Equal(t, []string{"gel"}, fm.registeredPlugins)
})
}