mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 07:11:08 +00:00
Merge pull request #1341 from AudriusButkevicius/configtest
Fix tests on Windows
This commit is contained in:
commit
fc123a71af
@ -26,7 +26,6 @@ import (
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/calmh/logger"
|
||||
"github.com/syncthing/protocol"
|
||||
@ -262,9 +261,13 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) {
|
||||
continue
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(folder.Path, string(filepath.Separator)) {
|
||||
folder.Path += string(filepath.Separator)
|
||||
}
|
||||
// The reason it's done like this:
|
||||
// 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 == "" {
|
||||
folder.ID = "default"
|
||||
|
@ -84,7 +84,7 @@ func TestDeviceConfig(t *testing.T) {
|
||||
expectedFolders := []FolderConfiguration{
|
||||
{
|
||||
ID: "test",
|
||||
Path: "testdata/",
|
||||
Path: "testdata",
|
||||
Devices: []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}},
|
||||
ReadOnly: true,
|
||||
RescanIntervalS: 600,
|
||||
@ -269,7 +269,7 @@ func TestIssue1262(t *testing.T) {
|
||||
}
|
||||
|
||||
actual := cfg.Folders()["test"].Path
|
||||
expected := "e:/"
|
||||
expected := "e:"
|
||||
if runtime.GOOS == "windows" {
|
||||
expected = `e:\`
|
||||
}
|
||||
|
2
internal/config/testdata/v1.xml
vendored
2
internal/config/testdata/v1.xml
vendored
@ -1,5 +1,5 @@
|
||||
<configuration version="1">
|
||||
<repository id="test" directory="testdata/">
|
||||
<repository id="test" directory="testdata">
|
||||
<node id="AIR6LPZ7K4PTTUXQSMUUCPQ5YWOEDFIIQJUG7772YQXXR5YD6AWQ" name="node one">
|
||||
<address>a</address>
|
||||
</node>
|
||||
|
2
internal/config/testdata/v2.xml
vendored
2
internal/config/testdata/v2.xml
vendored
@ -1,5 +1,5 @@
|
||||
<configuration version="2">
|
||||
<repository id="test" directory="testdata/" ro="true">
|
||||
<repository id="test" directory="testdata" ro="true">
|
||||
<node id="P56IOI7MZJNU2IQGDREYDM2MGTMGL3BXNPQ6W5BTBBZ4TJXZWICQ"/>
|
||||
<node id="AIR6LPZ7K4PTTUXQSMUUCPQ5YWOEDFIIQJUG7772YQXXR5YD6AWQ"/>
|
||||
<node id="C4YBIESWDUAIGU62GOSRXCRAAJDWVE3TKCPMURZE2LH5QHAF576A"/>
|
||||
|
2
internal/config/testdata/v3.xml
vendored
2
internal/config/testdata/v3.xml
vendored
@ -1,5 +1,5 @@
|
||||
<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="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2" compression="false"></node>
|
||||
</repository>
|
||||
|
2
internal/config/testdata/v4.xml
vendored
2
internal/config/testdata/v4.xml
vendored
@ -1,5 +1,5 @@
|
||||
<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="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></node>
|
||||
</repository>
|
||||
|
2
internal/config/testdata/v5.xml
vendored
2
internal/config/testdata/v5.xml
vendored
@ -1,5 +1,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="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||
</folder>
|
||||
|
2
internal/config/testdata/v6.xml
vendored
2
internal/config/testdata/v6.xml
vendored
@ -1,5 +1,5 @@
|
||||
<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="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||
</folder>
|
||||
|
2
internal/config/testdata/v7.xml
vendored
2
internal/config/testdata/v7.xml
vendored
@ -1,5 +1,5 @@
|
||||
<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="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||
</folder>
|
||||
|
Loading…
Reference in New Issue
Block a user