mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
Fix tests on Windows
This commit is contained in:
parent
ee000dabfd
commit
acd3dab957
@ -26,7 +26,6 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/calmh/logger"
|
"github.com/calmh/logger"
|
||||||
"github.com/syncthing/protocol"
|
"github.com/syncthing/protocol"
|
||||||
@ -262,9 +261,13 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.HasSuffix(folder.Path, string(filepath.Separator)) {
|
// The reason it's done like this:
|
||||||
folder.Path += string(filepath.Separator)
|
// C: -> C:\ -> C:\ (issue that this is trying to fix)
|
||||||
}
|
// C:\somedir -> C:\somedir\ -> C:\somedir
|
||||||
|
// C:\somedir\ -> C:\somedir\\ -> C:\somedir
|
||||||
|
// This way in the tests, we get away without OS specific separators
|
||||||
|
// in the test configs.
|
||||||
|
folder.Path = filepath.Dir(folder.Path + string(filepath.Separator))
|
||||||
|
|
||||||
if folder.ID == "" {
|
if folder.ID == "" {
|
||||||
folder.ID = "default"
|
folder.ID = "default"
|
||||||
|
@ -84,7 +84,7 @@ func TestDeviceConfig(t *testing.T) {
|
|||||||
expectedFolders := []FolderConfiguration{
|
expectedFolders := []FolderConfiguration{
|
||||||
{
|
{
|
||||||
ID: "test",
|
ID: "test",
|
||||||
Path: "testdata/",
|
Path: "testdata",
|
||||||
Devices: []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}},
|
Devices: []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}},
|
||||||
ReadOnly: true,
|
ReadOnly: true,
|
||||||
RescanIntervalS: 600,
|
RescanIntervalS: 600,
|
||||||
@ -269,7 +269,7 @@ func TestIssue1262(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actual := cfg.Folders()["test"].Path
|
actual := cfg.Folders()["test"].Path
|
||||||
expected := "e:/"
|
expected := "e:"
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
expected = `e:\`
|
expected = `e:\`
|
||||||
}
|
}
|
||||||
|
2
internal/config/testdata/v1.xml
vendored
2
internal/config/testdata/v1.xml
vendored
@ -1,5 +1,5 @@
|
|||||||
<configuration version="1">
|
<configuration version="1">
|
||||||
<repository id="test" directory="testdata/">
|
<repository id="test" directory="testdata">
|
||||||
<node id="AIR6LPZ7K4PTTUXQSMUUCPQ5YWOEDFIIQJUG7772YQXXR5YD6AWQ" name="node one">
|
<node id="AIR6LPZ7K4PTTUXQSMUUCPQ5YWOEDFIIQJUG7772YQXXR5YD6AWQ" name="node one">
|
||||||
<address>a</address>
|
<address>a</address>
|
||||||
</node>
|
</node>
|
||||||
|
2
internal/config/testdata/v2.xml
vendored
2
internal/config/testdata/v2.xml
vendored
@ -1,5 +1,5 @@
|
|||||||
<configuration version="2">
|
<configuration version="2">
|
||||||
<repository id="test" directory="testdata/" ro="true">
|
<repository id="test" directory="testdata" ro="true">
|
||||||
<node id="P56IOI7MZJNU2IQGDREYDM2MGTMGL3BXNPQ6W5BTBBZ4TJXZWICQ"/>
|
<node id="P56IOI7MZJNU2IQGDREYDM2MGTMGL3BXNPQ6W5BTBBZ4TJXZWICQ"/>
|
||||||
<node id="AIR6LPZ7K4PTTUXQSMUUCPQ5YWOEDFIIQJUG7772YQXXR5YD6AWQ"/>
|
<node id="AIR6LPZ7K4PTTUXQSMUUCPQ5YWOEDFIIQJUG7772YQXXR5YD6AWQ"/>
|
||||||
<node id="C4YBIESWDUAIGU62GOSRXCRAAJDWVE3TKCPMURZE2LH5QHAF576A"/>
|
<node id="C4YBIESWDUAIGU62GOSRXCRAAJDWVE3TKCPMURZE2LH5QHAF576A"/>
|
||||||
|
2
internal/config/testdata/v3.xml
vendored
2
internal/config/testdata/v3.xml
vendored
@ -1,5 +1,5 @@
|
|||||||
<configuration version="3">
|
<configuration version="3">
|
||||||
<repository id="test" directory="testdata/" ro="true" ignorePerms="false">
|
<repository id="test" directory="testdata" ro="true" ignorePerms="false">
|
||||||
<node id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR" compression="false"></node>
|
<node id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR" compression="false"></node>
|
||||||
<node id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2" compression="false"></node>
|
<node id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2" compression="false"></node>
|
||||||
</repository>
|
</repository>
|
||||||
|
2
internal/config/testdata/v4.xml
vendored
2
internal/config/testdata/v4.xml
vendored
@ -1,5 +1,5 @@
|
|||||||
<configuration version="4">
|
<configuration version="4">
|
||||||
<repository id="test" directory="testdata/" ro="true" ignorePerms="false" rescanIntervalS="600">
|
<repository id="test" directory="testdata" ro="true" ignorePerms="false" rescanIntervalS="600">
|
||||||
<node id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></node>
|
<node id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></node>
|
||||||
<node id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></node>
|
<node id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></node>
|
||||||
</repository>
|
</repository>
|
||||||
|
2
internal/config/testdata/v5.xml
vendored
2
internal/config/testdata/v5.xml
vendored
@ -1,5 +1,5 @@
|
|||||||
<configuration version="5">
|
<configuration version="5">
|
||||||
<folder id="test" path="testdata/" ro="true" ignorePerms="false" rescanIntervalS="600">
|
<folder id="test" path="testdata" ro="true" ignorePerms="false" rescanIntervalS="600">
|
||||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
||||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||||
</folder>
|
</folder>
|
||||||
|
2
internal/config/testdata/v6.xml
vendored
2
internal/config/testdata/v6.xml
vendored
@ -1,5 +1,5 @@
|
|||||||
<configuration version="6">
|
<configuration version="6">
|
||||||
<folder id="test" path="testdata/" ro="true" ignorePerms="false" rescanIntervalS="600">
|
<folder id="test" path="testdata" ro="true" ignorePerms="false" rescanIntervalS="600">
|
||||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
||||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||||
</folder>
|
</folder>
|
||||||
|
2
internal/config/testdata/v7.xml
vendored
2
internal/config/testdata/v7.xml
vendored
@ -1,5 +1,5 @@
|
|||||||
<configuration version="7">
|
<configuration version="7">
|
||||||
<folder id="test" path="testdata/" ro="true" ignorePerms="false" rescanIntervalS="600">
|
<folder id="test" path="testdata" ro="true" ignorePerms="false" rescanIntervalS="600">
|
||||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
||||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||||
</folder>
|
</folder>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user