Ensure file path is correct during stream restore

Also had to change all references from `path.` to `filepath.` when
dealing with files, so that it works properly on Windows.

Fixed also lots of tests to defer the shutdown of the server
after the removal of the storage, and fixed some config files
directories to use the single quote `'` to surround the file path,
again to work on Windows.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
Ivan Kozlovic
2022-03-08 15:22:08 -07:00
parent 0cb0f6d380
commit b4128693ed
23 changed files with 467 additions and 496 deletions

View File

@@ -0,0 +1,33 @@
{
"config": {
"name": "TEST",
"subjects": [
"foo"
],
"retention": "limits",
"max_consumers": -1,
"max_msgs_per_subject": -1,
"max_msgs": -1,
"max_bytes": -1,
"max_age": 0,
"max_msg_size": -1,
"storage": "file",
"discard": "old",
"num_replicas": 1,
"duplicate_window": 120000000000,
"sealed": false,
"deny_delete": false,
"deny_purge": false,
"allow_rollup_hdrs": false
},
"state": {
"messages": 10,
"bytes": 381,
"first_seq": 1,
"first_ts": "2022-03-07T23:59:01.710801Z",
"last_seq": 10,
"last_ts": "2022-03-07T23:59:01.712378Z",
"num_subjects": 1,
"consumer_count": 1
}
}

Binary file not shown.

View File

@@ -690,7 +690,7 @@ func TestOCSPReloadRotateTLSCertDisableMustStaple(t *testing.T) {
originalContent := `
port: -1
store_dir: "%s"
store_dir: '%s'
tls {
cert_file: "configs/certs/ocsp/server-status-request-url-01-cert.pem"
@@ -769,7 +769,7 @@ func TestOCSPReloadRotateTLSCertDisableMustStaple(t *testing.T) {
updatedContent := `
port: -1
store_dir: "%s"
store_dir: '%s'
tls {
cert_file: "configs/certs/ocsp/server-cert.pem"
@@ -1010,7 +1010,7 @@ func TestOCSPCluster(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
cluster {
name: AB
host: "127.0.0.1"
@@ -1044,7 +1044,7 @@ func TestOCSPCluster(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
cluster {
name: AB
host: "127.0.0.1"
@@ -1111,7 +1111,7 @@ func TestOCSPCluster(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
cluster {
name: AB
host: "127.0.0.1"
@@ -1206,7 +1206,7 @@ func TestOCSPCluster(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
cluster {
port: -1
name: AB
@@ -1284,7 +1284,7 @@ func TestOCSPLeaf(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
leafnodes {
host: "127.0.0.1"
port: -1
@@ -1317,7 +1317,7 @@ func TestOCSPLeaf(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
leafnodes {
remotes: [ {
url: "tls://127.0.0.1:%d"
@@ -1378,7 +1378,7 @@ func TestOCSPLeaf(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
leafnodes {
remotes: [ {
url: "tls://127.0.0.1:%d"
@@ -1468,7 +1468,7 @@ func TestOCSPLeaf(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
leafnodes {
host: "127.0.0.1"
port: -1
@@ -1555,7 +1555,7 @@ func TestOCSPGateway(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
gateway {
name: A
host: "127.0.0.1"
@@ -1589,7 +1589,7 @@ func TestOCSPGateway(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
gateway {
name: B
host: "127.0.0.1"
@@ -1662,7 +1662,7 @@ func TestOCSPGateway(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
gateway {
name: C
host: "127.0.0.1"
@@ -1758,7 +1758,7 @@ func TestOCSPGateway(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
gateway {
name: A
host: "127.0.0.1"
@@ -2623,7 +2623,7 @@ func TestOCSPSuperCluster(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
cluster {
name: A
@@ -2675,7 +2675,7 @@ func TestOCSPSuperCluster(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
cluster {
name: A
@@ -2748,7 +2748,7 @@ func TestOCSPSuperCluster(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
gateway {
name: C
host: "127.0.0.1"
@@ -2798,7 +2798,7 @@ func TestOCSPSuperCluster(t *testing.T) {
ca_file: "configs/certs/ocsp/ca-cert.pem"
timeout: 5
}
store_dir: "%s"
store_dir: '%s'
gateway {
name: D
host: "127.0.0.1"

View File

@@ -19,7 +19,7 @@ import (
"io/ioutil"
"math/rand"
"net/http"
"path"
"path/filepath"
"strings"
"sync"
"sync/atomic"
@@ -1814,7 +1814,7 @@ func TestServiceLatencyMissingResults(t *testing.T) {
server_name: s1
cluster { port: -1 }
include %q
`, path.Base(accConf))))
`, filepath.Base(accConf))))
defer removeFile(t, s1Conf)
s1, opts1 := RunServerWithConfig(s1Conf)
@@ -1828,7 +1828,7 @@ func TestServiceLatencyMissingResults(t *testing.T) {
routes = [ nats-route://127.0.0.1:%d ]
}
include %q
`, opts1.Cluster.Port, path.Base(accConf))))
`, opts1.Cluster.Port, filepath.Base(accConf))))
defer removeFile(t, s2Conf)
s2, opts2 := RunServerWithConfig(s2Conf)