Repository: nats-io/nats.go
Pull request #1019 (2022-07-22 07:00:08)

Allow setting consumer replicas though options
Currently, only `js.AddConsumer` supports configuring replicas count for a consumer. Configuring it through `nats.SubOpt` will allow configuring the same with `js.Subscribe`, `js.PullSubscribe` etc.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/51077144/badge)](https://coveralls.io/builds/51077144)

Coverage increased (+0.001%) to 84.087% when pulling **c5c2b8ebd28df5eaf1fd00950b28e9a88098b5ed on goku321:opt-cons-replica** into **f4a86f30ce2a7d36cfdb4ceb6669961406ac9f61 on nats-io:main**.

piotrpio: Hey, this looks good, I just have 2 suggestions:
1. Could you add a simple check in `checkConfig()` func in `js.go` to verify whether the value is not changed if the consumer already exists (this is done for other settable parameters as well to avoid overwriting existing config in `Subscribe()`
2. It would be nice to have at least a simple test in `test/js_test.go` to verify whether a consumer created with `Subscribe()` has a proper `Replicas` value set in config.
kozlovic: @piotrpio @derekcollison @tbeets I may be mistaken, but the approach of the JS simplification is that we would no longer create JS consumers, so not sure if it is advisable to add those sub options that would no longer be needed after the upcoming simplification?
piotrpio: @kozlovic Simplified JestStream API will be in it's own package, so the current implementation can be modified separately. 
You're right, the simplified API will not allow creating consumers at the time of subscribing, so there will be no need for adding those options.

Patch:
diff --git a/.travis.yml b/.travis.yml
index 1d05d3f..6da4a9e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,21 +1,25 @@
 language: go
 go:
+- 1.18.x
 - 1.17.x
-- 1.16.x
 go_import_path: github.com/nats-io/nats.go
 install:
 - go get -t ./...
-- go get github.com/mattn/goveralls
-- go get github.com/wadey/gocovmerge
-- go install honnef.co/go/tools/cmd/staticcheck@v0.2.2
-- go get -u github.com/client9/misspell/cmd/misspell
+- if [[ "$TRAVIS_GO_VERSION" =~ 1.18 ]]; then
+    go install github.com/mattn/goveralls@latest;
+    go install github.com/wadey/gocovmerge@latest;
+    go install honnef.co/go/tools/cmd/staticcheck@latest;
+    go install github.com/client9/misspell/cmd/misspell@latest;
+  fi
 before_script:
 - $(exit $(go fmt ./... | wc -l))
 - go vet -modfile=go_test.mod ./...
-- find . -type f -name "*.go" | xargs misspell -error -locale US
-- GOFLAGS="-mod=mod -modfile=go_test.mod" staticcheck ./...
+- if [[ "$TRAVIS_GO_VERSION" =~ 1.18 ]]; then
+    find . -type f -name "*.go" | xargs misspell -error -locale US;
+    GOFLAGS="-mod=mod -modfile=go_test.mod" staticcheck ./...;
+  fi
 script:
 - go test -modfile=go_test.mod -v -run=TestNoRace -p=1 ./... --failfast -vet=off
-- if [[ "$TRAVIS_GO_VERSION" =~ 1.17 ]]; then ./scripts/cov.sh TRAVIS; else go test -modfile=go_test.mod -race -v -p=1 ./... --failfast -vet=off; fi
+- if [[ "$TRAVIS_GO_VERSION" =~ 1.18 ]]; then ./scripts/cov.sh TRAVIS; else go test -modfile=go_test.mod -race -v -p=1 ./... --failfast -vet=off; fi
 after_success:
-- if [[ "$TRAVIS_GO_VERSION" =~ 1.17 ]]; then $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci; fi
+- if [[ "$TRAVIS_GO_VERSION" =~ 1.18 ]]; then $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci; fi
diff --git a/js.go b/js.go
index 76033e5..5ea6c9f 100644
--- a/js.go
+++ b/js.go
@@ -1332,6 +1332,9 @@ func checkConfig(s, u *ConsumerConfig) error {
 	if u.Heartbeat > 0 && u.Heartbeat != s.Heartbeat {
 		return makeErr("heartbeat", u.Heartbeat, s.Heartbeat)
 	}
+	if u.Replicas > 0 && u.Replicas != s.Replicas {
+		return makeErr("replicas", u.Replicas, s.Replicas)
+	}
 	return nil
 }
 
@@ -2449,6 +2452,17 @@ func InactiveThreshold(threshold time.Duration) SubOpt {
 	})
 }
 
+// ConsumerReplicas sets the number of replica count for a consumer.
+func ConsumerReplicas(replicas int) SubOpt {
+	return subOptFn(func(opts *subOpts) error {
+		if replicas < 1 {
+			return fmt.Errorf("invalid ConsumerReplicas value (%v), needs to be greater than 0", replicas)
+		}
+		opts.cfg.Replicas = replicas
+		return nil
+	})
+}
+
 func (sub *Subscription) ConsumerInfo() (*ConsumerInfo, error) {
 	sub.mu.Lock()
 	// TODO(dlc) - Better way to mark especially if we attach.
@@ -3325,9 +3339,9 @@ const (
 func (st StorageType) String() string {
 	switch st {
 	case MemoryStorage:
-		return strings.Title(memoryStorageString)
+		return "Memory"
 	case FileStorage:
-		return strings.Title(fileStorageString)
+		return "File"
 	default:
 		return "Unknown Storage Type"
 	}
diff --git a/scripts/cov.sh b/scripts/cov.sh
index 7ea9253..7407775 100755
--- a/scripts/cov.sh
+++ b/scripts/cov.sh
@@ -3,10 +3,10 @@
 
 rm -rf ./cov
 mkdir cov
-go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/nats.out -run='Test[^NoRace]'
-go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/test.out -coverpkg=github.com/nats-io/nats.go -run='Test[^NoRace]' ./test
-go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/builtin.out -coverpkg=github.com/nats-io/nats.go/encoders/builtin ./test -run EncBuiltin
-go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/protobuf.out -coverpkg=github.com/nats-io/nats.go/encoders/protobuf ./test -run EncProto
+go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/nats.out . -tags=skip_no_race_tests
+go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/test.out -coverpkg=github.com/nats-io/nats.go ./test -tags=skip_no_race_tests
+go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/builtin.out -coverpkg=github.com/nats-io/nats.go/encoders/builtin ./test -run EncBuiltin -tags=skip_no_race_tests
+go test -modfile=go_test.mod --failfast -vet=off -v -covermode=atomic -coverprofile=./cov/protobuf.out -coverpkg=github.com/nats-io/nats.go/encoders/protobuf ./test -run EncProto -tags=skip_no_race_tests
 gocovmerge ./cov/*.out > acc.out
 rm -rf ./cov
 


Test patch:
diff --git a/example_test.go b/example_test.go
index 08616a7..42e3f32 100644
--- a/example_test.go
+++ b/example_test.go
@@ -625,6 +625,11 @@ func ExampleSubOpt() {
 	js.Subscribe("foo", func(msg *nats.Msg) {
 		fmt.Printf("Received a message: %s\n", string(msg.Data))
 	}, nats.ManualAck(), nats.MaxDeliver(2), nats.BackOff([]time.Duration{50 * time.Millisecond, 250 * time.Millisecond}))
+
+	// Set consumer replicas count for a durable while subscribing.
+	js.Subscribe("foo", func(msg *nats.Msg) {
+		fmt.Printf("Received a message: %s\n", string(msg.Data))
+	}, nats.Durable("FOO"), nats.ConsumerReplicas(1))
 }
 
 func ExampleMaxWait() {
diff --git a/go_test.mod b/go_test.mod
index d5a98ca..9de5e15 100644
--- a/go_test.mod
+++ b/go_test.mod
@@ -4,7 +4,7 @@ go 1.17
 
 require (
 	github.com/golang/protobuf v1.4.2
-	github.com/nats-io/nats-server/v2 v2.8.5-0.20220725185857-9446170af436
+	github.com/nats-io/nats-server/v2 v2.8.5-0.20220729163007-8aee7d5e51d4
 	github.com/nats-io/nkeys v0.3.0
 	github.com/nats-io/nuid v1.0.1
 	google.golang.org/protobuf v1.23.0
diff --git a/go_test.sum b/go_test.sum
index b66a22a..8fa507d 100644
--- a/go_test.sum
+++ b/go_test.sum
@@ -20,8 +20,8 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA
 github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
 github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI=
 github.com/nats-io/jwt/v2 v2.3.0/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k=
-github.com/nats-io/nats-server/v2 v2.8.5-0.20220725185857-9446170af436 h1:1klEMbLkqGBWaS5L/WM1rNL5n/yL4weFaWkgV+jXPVU=
-github.com/nats-io/nats-server/v2 v2.8.5-0.20220725185857-9446170af436/go.mod h1:3Yg3ApyQxPlAs1KKHKV5pobV5VtZk+TtOiUJx/iqkkg=
+github.com/nats-io/nats-server/v2 v2.8.5-0.20220729163007-8aee7d5e51d4 h1:hAhXb/iuQNPZe9y0wFift4hkiquMlNF5WuMhpoMlUUM=
+github.com/nats-io/nats-server/v2 v2.8.5-0.20220729163007-8aee7d5e51d4/go.mod h1:3Yg3ApyQxPlAs1KKHKV5pobV5VtZk+TtOiUJx/iqkkg=
 github.com/nats-io/nats.go v1.16.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
 github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
 github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
diff --git a/norace_test.go b/norace_test.go
index afac463..0edbf0d 100644
--- a/norace_test.go
+++ b/norace_test.go
@@ -11,8 +11,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-//go:build !race
-// +build !race
+//go:build !race && !skip_no_race_tests
+// +build !race,!skip_no_race_tests
 
 package nats
 
diff --git a/test/configs/certs/ca.pem b/test/configs/certs/ca.pem
index d13e913..117f6f3 100644
--- a/test/configs/certs/ca.pem
+++ b/test/configs/certs/ca.pem
@@ -1,20 +1,27 @@
 -----BEGIN CERTIFICATE-----
-MIIDXDCCAkQCCQDI2Vsry8+BDDANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJV
-UzELMAkGA1UECAwCQ0ExEDAOBgNVBAoMB1N5bmFkaWExEDAOBgNVBAsMB25hdHMu
-aW8xEjAQBgNVBAMMCWxvY2FsaG9zdDEcMBoGCSqGSIb3DQEJARYNZGVyZWt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gMAwGA1UdEwQFMAMBAf8wOgYJYIZIAYb4QgENBC0WK25hdHMuaW8gbmF0
+cy1zZXJ2ZXIgdGVzdC1zdWl0ZSB0cmFuc2llbnQgQ0EwDQYJKoZIhvcNAQELBQAD
+ggEBALVWJo2ZiafGd76Tvg/08ap7kJL8SBLosXoaD6gRAaqC5alG0bB8/pgl3uNJ
+EUhBYp0txjngJorE6eQjW5hoEZLKJmHfct7v4kLICEk95T3xk1jUwnr/YKboawv6
+HXpelaz2f9J4UIiIe8i9NivUp0C/h3qhdwjk46b7GjSSobyc1+0p+pBjPJUbXpJv
+/1G70Ap+5P9E7f2bdFgud4y6I05tnflklaM/PB7MxJ86j5/jhqK5h9BJKE62zI3z
+2LEgJAmuUREThPzVuw8+4rCdK2WMQ9iQyx6IDMrUkyDWY9D2rmrUGuXX6jIPlLja
+509Q4MQLUj9Ou1lF60caBg3bq9c=
 -----END CERTIFICATE-----
diff --git a/test/configs/certs/client-cert.pem b/test/configs/certs/client-cert.pem
index 979737b..01decd4 100644
--- a/test/configs/certs/client-cert.pem
+++ b/test/configs/certs/client-cert.pem
@@ -1,20 +1,99 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            38:93:ed:6f:04:c5:57:98:f2:5b:ff:e6:56:8b:ae:63:b7:8c:45:59
+        Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=California, O=Synadia, OU=nats.io, CN=Certificate Authority 2022-07-28
+        Validity
+            Not Before: Jul 28 06:52:52 2022 GMT
+            Not After : Jul 25 06:52:52 2032 GMT
+        Subject: C=US, ST=California, O=Synadia, OU=nats.io, CN=localhost
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                RSA Public-Key: (2048 bit)
+                Modulus:
+                    00:ac:9c:3e:9d:3b:7a:12:56:85:78:ca:df:9c:fc:
+                    0c:7e:5e:f2:4f:22:33:46:81:38:53:d7:a7:25:8f:
+                    d7:ee:16:13:e2:67:49:88:f6:94:99:f0:a9:a6:db:
+                    fe:7a:17:c9:e3:df:31:73:71:38:70:3a:96:1e:99:
+                    7b:5d:07:e3:63:e4:e8:bf:99:f7:3d:5c:27:f5:b7:
+                    37:29:da:ee:82:80:00:d4:c8:d3:1b:36:0d:8b:d3:
+                    8a:9b:8e:12:a1:4d:0c:c5:22:f8:56:3b:6a:1a:fb:
+                    e9:3d:08:1e:13:7f:55:6e:2e:65:93:9a:90:54:03:
+                    6d:0d:e6:44:d6:f7:c0:d7:d8:e1:c7:1e:c2:9b:a3:
+                    6e:88:f1:7c:58:08:a2:9f:13:cc:5b:b9:11:2c:1d:
+                    23:6f:3a:ae:47:9a:0f:6a:ce:e5:80:34:09:e6:e3:
+                    fd:76:4a:cf:5a:18:bb:9c:c5:c1:74:49:67:77:1b:
+                    ba:28:86:31:a6:fc:12:af:4a:85:1b:73:5b:f4:d6:
+                    42:ff:0c:1c:49:e7:31:f2:5a:2a:1e:cd:87:cb:22:
+                    ff:70:1c:48:ed:ba:e0:be:f0:bc:9e:e0:dc:59:db:
+                    a5:74:25:58:b3:61:04:f6:33:28:6b:07:25:60:0f:
+                    72:93:16:6c:9f:b0:ad:4a:18:f7:9e:29:1e:b7:61:
+                    34:17
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Basic Constraints: 
+                CA:FALSE
+            Netscape Comment: 
+                nats.io nats-server test-suite certificate
+            X509v3 Subject Key Identifier: 
+                1F:14:EF:2B:53:AB:28:4A:93:42:98:AE:85:06:0F:B4:7D:DC:36:AE
+            X509v3 Authority Key Identifier: 
+                keyid:4A:C2:12:A8:56:1F:08:4A:9B:33:42:10:F2:75:86:C3:45:17:4C:14
+                DirName:/C=US/ST=California/O=Synadia/OU=nats.io/CN=Certificate Authority 2022-07-28
+                serial:51:B7:7B:F5:26:C0:C7:F4:C9:3D:10:3E:A1:86:8C:47:67:2A:46:60
+
+            X509v3 Subject Alternative Name: 
+                DNS:localhost, IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1, email:derek@nats.io
+            Netscape Cert Type: 
+                SSL Client
+            X509v3 Key Usage: 
+                Digital Signature, Key Encipherment
+            X509v3 Extended Key Usage: 
+                TLS Web Client Authentication
+    Signature Algorithm: sha256WithRSAEncryption
+         4b:c0:a6:70:49:fa:2d:c0:99:df:0f:0b:1b:1e:4a:68:eb:c4:
+         48:7c:d2:93:9d:ca:66:e2:c6:76:0f:4a:79:5a:f8:ad:d0:de:
+         18:ad:05:66:17:1d:c2:0f:00:76:d2:a2:70:7f:38:51:2d:69:
+         ae:d3:59:fb:ba:c3:4d:5a:69:e8:bd:25:73:22:c7:93:c7:05:
+         c2:12:31:d0:5a:4e:11:2f:74:10:66:c0:98:b9:2b:43:f0:61:
+         22:05:82:ec:f7:57:2a:cc:56:9d:44:d4:2d:80:10:5d:87:31:
+         39:d3:7f:12:35:cb:60:11:fc:29:22:2c:17:ab:85:5f:83:b4:
+         57:d1:67:7a:86:04:10:dc:e8:84:b0:f3:1d:36:9a:71:d2:c7:
+         f2:ce:36:63:3a:c1:6e:4b:29:d9:77:c8:e0:b9:fd:73:77:3f:
+         83:1e:bb:99:1f:6c:67:da:d1:34:b2:47:a2:4a:ef:00:23:02:
+         4f:10:ef:24:b2:70:00:ce:26:3e:72:5f:a5:8a:1d:2b:3e:34:
+         2d:c7:c5:60:dc:33:69:88:1e:06:a3:c3:90:58:09:71:ca:6a:
+         d9:7e:13:5a:81:c0:0d:44:40:52:41:8d:1b:e9:2f:4c:cd:68:
+         68:68:d3:60:c7:3f:61:5c:ab:65:a4:98:c9:8b:7b:b5:fc:dc:
+         86:d1:a3:13
 -----BEGIN CERTIFICATE-----
-MIIDQjCCAiqgAwIBAgIJAJCSLX9jr5WzMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
-BAYTAlVTMQswCQYDVQQIDAJDQTEQMA4GA1UECgwHU3luYWRpYTEQMA4GA1UECwwH
-bmF0cy5pbzESMBAGA1UEAwwJbG9jYWxob3N0MRwwGgYJKoZIhvcNAQkBFg1kZX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d79SbAx/TJPRA+oYaM
+R2cqRmAwOwYDVR0RBDQwMoIJbG9jYWxob3N0hwR/AAABhxAAAAAAAAAAAAAAAAAA
+AAABgQ1kZXJla0BuYXRzLmlvMBEGCWCGSAGG+EIBAQQEAwIHgDALBgNVHQ8EBAMC
+BaAwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAEvApnBJ
++i3Amd8PCxseSmjrxEh80pOdymbixnYPSnla+K3Q3hitBWYXHcIPAHbSonB/OFEt
+aa7TWfu6w01aaei9JXMix5PHBcISMdBaThEvdBBmwJi5K0PwYSIFguz3VyrMVp1E
+1C2AEF2HMTnTfxI1y2AR/CkiLBerhV+DtFfRZ3qGBBDc6ISw8x02mnHSx/LONmM6
+wW5LKdl3yOC5/XN3P4Meu5kfbGfa0TSyR6JK7wAjAk8Q7ySycADOJj5yX6WKHSs+
+NC3HxWDcM2mIHgajw5BYCXHKatl+E1qBwA1EQFJBjRvpL0zNaGho02DHP2Fcq2Wk
+mMmLe7X83IbRoxM=
 -----END CERTIFICATE-----
diff --git a/test/configs/certs/server.pem b/test/configs/certs/server.pem
index e36fd9d..7d4ca2c 100644
--- a/test/configs/certs/server.pem
+++ b/test/configs/certs/server.pem
@@ -1,20 +1,99 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            7f:da:fc:40:69:2a:9f:52:26:7e:4c:98:15:5d:cc:69:84:be:9c:a5
+        Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=California, O=Synadia, OU=nats.io, CN=Certificate Authority 2022-07-28
+        Validity
+            Not Before: Jul 28 06:52:52 2022 GMT
+            Not After : Jul 25 06:52:52 2032 GMT
+        Subject: C=US, ST=California, O=Synadia, OU=nats.io, CN=localhost
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                RSA Public-Key: (2048 bit)
+                Modulus:
+                    00:e6:fb:47:65:cd:c9:a2:2d:af:8b:cd:d5:6a:79:
+                    54:3c:07:5f:eb:5a:71:2b:2b:e5:6f:be:31:fb:16:
+                    65:68:76:0e:59:e7:e4:57:ca:88:e9:77:d6:41:ad:
+                    57:7a:42:b2:d2:54:c4:0f:7c:5b:c1:bc:61:97:e3:
+                    22:3a:3e:1e:4a:5d:47:9f:6b:7d:6f:34:e3:8c:86:
+                    9d:85:19:29:9a:11:58:44:4c:a1:90:d3:14:61:e1:
+                    57:da:01:ea:ce:3f:90:ae:9e:5d:13:6d:2c:89:ca:
+                    39:15:6b:b6:9e:32:d7:2a:4c:48:85:2f:b0:1e:d8:
+                    4b:62:32:14:eb:32:b6:29:04:34:3c:af:39:b6:8b:
+                    52:32:4d:bf:43:5f:9b:fb:0d:43:a6:ad:2c:a7:41:
+                    29:55:c9:70:b3:b5:15:46:34:bf:e4:1e:52:2d:a4:
+                    49:2e:d5:21:ed:fc:00:f7:a2:0b:bc:12:0a:90:64:
+                    50:7c:c5:14:70:f5:fb:9b:62:08:78:43:49:31:f3:
+                    47:b8:93:d4:2d:4c:a9:dc:17:70:76:34:66:ff:65:
+                    c1:39:67:e9:a6:1c:80:6a:f0:9d:b3:28:c8:a3:3a:
+                    b7:5d:de:6e:53:6d:09:b3:0d:b1:13:10:e8:ec:e0:
+                    bd:5e:a1:94:4b:70:bf:dc:bd:8b:b9:82:65:dd:af:
+                    81:7b
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Basic Constraints: 
+                CA:FALSE
+            Netscape Comment: 
+                nats.io nats-server test-suite certificate
+            X509v3 Subject Key Identifier: 
+                2B:8C:A3:8B:DB:DB:5C:CE:18:DB:F6:A8:31:4E:C2:3E:EE:D3:40:7E
+            X509v3 Authority Key Identifier: 
+                keyid:4A:C2:12:A8:56:1F:08:4A:9B:33:42:10:F2:75:86:C3:45:17:4C:14
+                DirName:/C=US/ST=California/O=Synadia/OU=nats.io/CN=Certificate Authority 2022-07-28
+                serial:51:B7:7B:F5:26:C0:C7:F4:C9:3D:10:3E:A1:86:8C:47:67:2A:46:60
+
+            X509v3 Subject Alternative Name: 
+                DNS:localhost, IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1
+            Netscape Cert Type: 
+                SSL Client, SSL Server
+            X509v3 Key Usage: 
+                Digital Signature, Key Encipherment
+            X509v3 Extended Key Usage: 
+                TLS Web Server Authentication, Netscape Server Gated Crypto, Microsoft Server Gated Crypto, TLS Web Client Authentication
+    Signature Algorithm: sha256WithRSAEncryption
+         3c:59:f0:8d:f2:06:96:14:68:3a:7c:69:96:6e:2e:7a:43:9e:
+         65:f2:ef:73:2a:fc:71:cf:44:fc:c9:dc:f8:09:4d:f9:aa:69:
+         65:9c:ff:d0:cd:6a:15:d0:40:ed:8b:c9:69:9a:73:4f:54:c3:
+         a1:ad:63:28:4d:2d:84:6f:c1:e0:3e:98:1c:9f:a4:b7:2f:de:
+         e0:2c:f3:a2:3d:52:46:64:f4:ad:da:d4:32:f1:4f:03:54:fa:
+         7a:61:25:b8:e2:62:5f:86:82:ee:48:d7:7e:e1:10:f8:71:fe:
+         eb:bf:4a:eb:3b:b6:f4:b6:eb:79:b0:6b:5b:4c:c4:a7:46:ff:
+         7b:38:09:82:d3:bf:4b:b0:0b:f8:81:01:44:fb:b1:6b:75:6a:
+         86:c6:0f:d7:58:a3:9f:e7:3b:41:77:31:24:ce:00:01:ef:a5:
+         63:05:78:10:61:43:c1:6d:68:7b:7a:94:e8:d4:c5:5e:96:b2:
+         14:62:3b:1a:80:12:e7:21:70:6e:ee:53:cd:85:ae:d7:c2:73:
+         58:26:d8:9c:de:d3:94:0b:81:7b:a2:df:0d:b9:03:f7:81:53:
+         d5:be:dd:f7:4f:39:61:32:f6:1a:a9:8d:4d:f8:07:7e:d2:7c:
+         e6:58:3e:ad:1c:b0:74:d9:f8:99:36:94:c2:f7:14:63:8a:75:
+         e0:41:d0:1c
 -----BEGIN CERTIFICATE-----
-MIIDPTCCAiWgAwIBAgIJAJCSLX9jr5W7MA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV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EQYDVQQIDApDYWxpZm9ybmlh
+MRAwDgYDVQQKDAdTeW5hZGlhMRAwDgYDVQQLDAduYXRzLmlvMSkwJwYDVQQDDCBD
+ZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAyMi0wNy0yOIIUUbd79SbAx/TJPRA+oYaM
+R2cqRmAwLAYDVR0RBCUwI4IJbG9jYWxob3N0hwR/AAABhxAAAAAAAAAAAAAAAAAA
+AAABMBEGCWCGSAGG+EIBAQQEAwIGwDALBgNVHQ8EBAMCBaAwNAYDVR0lBC0wKwYI
+KwYBBQUHAwEGCWCGSAGG+EIEAQYKKwYBBAGCNwoDAwYIKwYBBQUHAwIwDQYJKoZI
+hvcNAQELBQADggEBADxZ8I3yBpYUaDp8aZZuLnpDnmXy73Mq/HHPRPzJ3PgJTfmq
+aWWc/9DNahXQQO2LyWmac09Uw6GtYyhNLYRvweA+mByfpLcv3uAs86I9UkZk9K3a
+1DLxTwNU+nphJbjiYl+Ggu5I137hEPhx/uu/Sus7tvS263mwa1tMxKdG/3s4CYLT
+v0uwC/iBAUT7sWt1aobGD9dYo5/nO0F3MSTOAAHvpWMFeBBhQ8FtaHt6lOjUxV6W
+shRiOxqAEuchcG7uU82FrtfCc1gm2Jze05QLgXui3w25A/eBU9W+3fdPOWEy9hqp
+jU34B37SfOZYPq0csHTZ+Jk2lML3FGOKdeBB0Bw=
 -----END CERTIFICATE-----
diff --git a/test/configs/certs/server_noip.pem b/test/configs/certs/server_noip.pem
index d20c390..19d767e 100644
--- a/test/configs/certs/server_noip.pem
+++ b/test/configs/certs/server_noip.pem
@@ -1,20 +1,99 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            77:0f:ba:c1:58:65:ed:b9:8b:66:43:58:ee:2f:3a:37:c0:f5:6d:7a
+        Signature Algorithm: sha256WithRSAEncryption
+        Issuer: C=US, ST=California, O=Synadia, OU=nats.io, CN=Certificate Authority 2022-07-28
+        Validity
+            Not Before: Jul 28 06:52:52 2022 GMT
+            Not After : Jul 25 06:52:52 2032 GMT
+        Subject: C=US, ST=California, O=Synadia, OU=nats.io, CN=localhost
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                RSA Public-Key: (2048 bit)
+                Modulus:
+                    00:ad:f0:87:3f:32:66:87:7a:31:9b:ca:54:0a:ae:
+                    a6:1a:ca:25:d5:c5:fc:49:6b:21:0b:de:a7:15:c8:
+                    9c:3c:cd:41:1d:32:25:77:68:7b:83:e8:5d:14:7a:
+                    2e:0b:ea:41:91:a4:20:ec:20:17:0f:cb:8d:4c:1b:
+                    88:a0:d2:77:46:65:7e:d1:a0:e6:4c:4b:c6:8c:39:
+                    a1:b3:5b:34:57:c8:a1:10:0c:13:54:3a:74:90:7b:
+                    3b:ba:da:41:62:81:f5:dc:b5:73:6c:83:38:f4:a1:
+                    52:ab:bd:c2:95:3e:79:ff:af:a4:ae:df:d6:11:d9:
+                    29:20:b8:b4:15:e3:32:93:5c:36:ce:56:b4:01:02:
+                    a1:45:31:a3:a1:1e:ea:b8:c4:01:04:57:11:44:f4:
+                    55:ea:e2:ae:68:08:70:85:c0:5b:ff:ba:bf:de:8b:
+                    bc:a1:c6:03:a2:2f:8a:eb:9e:b7:79:3a:67:6a:b0:
+                    70:d3:e8:08:a7:12:24:d5:bb:57:88:72:37:c8:e6:
+                    2e:db:87:e0:2a:71:1a:2c:90:9c:88:29:0c:75:28:
+                    84:d6:7f:75:2d:50:08:36:2b:cf:f3:ba:33:72:1e:
+                    7a:07:db:20:da:98:3b:39:86:96:4c:e2:4a:42:61:
+                    1a:9b:0b:67:4d:6d:13:d1:9f:40:df:12:c7:8d:9d:
+                    50:69
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Basic Constraints: 
+                CA:FALSE
+            Netscape Comment: 
+                nats.io nats-server test-suite certificate
+            X509v3 Subject Key Identifier: 
+                C9:AA:3C:08:39:7E:C1:42:C0:3D:B7:2F:84:21:E7:8A:30:E7:C7:B1
+            X509v3 Authority Key Identifier: 
+                keyid:4A:C2:12:A8:56:1F:08:4A:9B:33:42:10:F2:75:86:C3:45:17:4C:14
+                DirName:/C=US/ST=California/O=Synadia/OU=nats.io/CN=Certificate Authority 2022-07-28
+                serial:51:B7:7B:F5:26:C0:C7:F4:C9:3D:10:3E:A1:86:8C:47:67:2A:46:60
+
+            X509v3 Subject Alternative Name: 
+                DNS:localhost
+            Netscape Cert Type: 
+                SSL Client, SSL Server
+            X509v3 Key Usage: 
+                Digital Signature, Key Encipherment
+            X509v3 Extended Key Usage: 
+                TLS Web Server Authentication, Netscape Server Gated Crypto, Microsoft Server Gated Crypto, TLS Web Client Authentication
+    Signature Algorithm: sha256WithRSAEncryption
+         8a:6c:5f:ff:0f:ac:18:69:2c:f7:9c:29:23:21:00:c6:94:84:
+         1c:a9:9f:1b:0c:e3:af:0c:81:ba:40:e3:ca:33:21:c2:55:e3:
+         da:c9:90:5c:82:44:76:cd:8e:a4:04:7e:8d:4a:9e:b1:72:09:
+         b6:01:0d:25:60:b8:e3:09:ea:68:1b:40:bc:78:95:46:b1:8f:
+         ec:66:7b:5f:fa:23:be:80:16:93:ba:04:fb:07:c7:70:04:8f:
+         c2:85:90:33:6b:4d:fc:de:cc:0e:61:67:8f:12:98:f1:38:0b:
+         c9:bb:b4:64:6a:f6:73:5f:ba:00:cf:50:35:64:92:cc:26:76:
+         4d:a4:2a:d9:47:e1:5c:48:45:52:23:03:dd:90:15:e5:1d:5d:
+         10:53:dd:57:6f:32:03:39:0b:32:d7:ae:23:2f:9f:f9:12:a4:
+         3a:3d:54:9d:18:56:bf:03:34:d5:4b:49:3e:12:5c:cc:a0:52:
+         a5:da:2b:e6:cf:33:ce:8b:63:c2:00:a2:c0:aa:d8:ce:e8:b5:
+         88:fb:53:0f:dd:45:35:1d:3a:d6:38:62:63:e5:e0:5f:a1:a7:
+         8e:86:29:2d:a7:8f:aa:a4:1f:fd:f4:f5:3c:21:61:b3:d4:cd:
+         1d:89:a1:a7:19:fb:e6:6b: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4EFgQU
+yao8CDl+wULAPbcvhCHnijDnx7Ewga4GA1UdIwSBpjCBo4AUSsISqFYfCEqbM0IQ
+8nWGw0UXTBShdaRzMHExCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlh
+MRAwDgYDVQQKDAdTeW5hZGlhMRAwDgYDVQQLDAduYXRzLmlvMSkwJwYDVQQDDCBD
+ZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAyMi0wNy0yOIIUUbd79SbAx/TJPRA+oYaM
+R2cqRmAwFAYDVR0RBA0wC4IJbG9jYWxob3N0MBEGCWCGSAGG+EIBAQQEAwIGwDAL
+BgNVHQ8EBAMCBaAwNAYDVR0lBC0wKwYIKwYBBQUHAwEGCWCGSAGG+EIEAQYKKwYB
+BAGCNwoDAwYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAIpsX/8PrBhpLPec
+KSMhAMaUhBypnxsM468MgbpA48ozIcJV49rJkFyCRHbNjqQEfo1KnrFyCbYBDSVg
+uOMJ6mgbQLx4lUaxj+xme1/6I76AFpO6BPsHx3AEj8KFkDNrTfzezA5hZ48SmPE4
+C8m7tGRq9nNfugDPUDVkkswmdk2kKtlH4VxIRVIjA92QFeUdXRBT3VdvMgM5CzLX
+riMvn/kSpDo9VJ0YVr8DNNVLST4SXMygUqXaK+bPM86LY8IAosCq2M7otYj7Uw/d
+RTUdOtY4YmPl4F+hp46GKS2nj6qkH/309TwhYbPUzR2JoacZ++ZrQURQ7RV/ZSMB
+PBrn18M=
 -----END CERTIFICATE-----
diff --git a/test/conn_test.go b/test/conn_test.go
index 3d426b4..4af5f9d 100644
--- a/test/conn_test.go
+++ b/test/conn_test.go
@@ -1314,7 +1314,7 @@ func TestUseDefaultTimeout(t *testing.T) {
 	}
 }
 
-func TestNoRaceOnLastError(t *testing.T) {
+func TestLastErrorNoRace(t *testing.T) {
 	s := RunDefaultServer()
 	defer s.Shutdown()
 
diff --git a/test/js_test.go b/test/js_test.go
index a5482d6..7aec29d 100644
--- a/test/js_test.go
+++ b/test/js_test.go
@@ -7272,3 +7272,36 @@ func TestJetStreamDirectGetMsg(t *testing.T) {
 		t.Fatalf("Unexpected error: %v", err)
 	}
 }
+
+func TestJetStreamConsumerReplicasOption(t *testing.T) {
+	withJSCluster(t, "CR", 3, func(t *testing.T, nodes ...*jsServer) {
+		nc, js := jsClient(t, nodes[0].Server)
+		defer nc.Close()
+
+		if _, err := js.AddStream(&nats.StreamConfig{
+			Name:     "ConsumerReplicasTest",
+			Subjects: []string{"foo"},
+			Replicas: 3,
+		}); err != nil {
+			t.Fatalf("Error adding stream: %v", err)
+		}
+
+		// Subscribe to the stream with a durable consumer "bar" and replica set to 1.
+		cb := func(msg *nats.Msg) {}
+		_, err := js.Subscribe("foo", cb, nats.Durable("bar"), nats.ConsumerReplicas(1))
+		if err != nil {
+			t.Fatalf("Error on subscribe: %v", err)
+		}
+
+		// Get consumer info
+		consInfo, err := js.ConsumerInfo("ConsumerReplicasTest", "bar")
+		if err != nil {
+			t.Fatalf("Error getting consumer info: %v", err)
+		}
+
+		// Check if the number of replicas is the same as we provided.
+		if consInfo.Config.Replicas != 1 {
+			t.Fatalf("Expected consumer replica to be %v, got %+v", 1, consInfo.Config.Replicas)
+		}
+	})
+}
diff --git a/test/norace_test.go b/test/norace_test.go
index 20f5bcc..9a72fa3 100644
--- a/test/norace_test.go
+++ b/test/norace_test.go
@@ -11,8 +11,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-//go:build !race
-// +build !race
+//go:build !race && !skip_no_race_tests
+// +build !race,!skip_no_race_tests
 
 package test
 
diff --git a/ws_test.go b/ws_test.go
index 4dec114..3b8a374 100644
--- a/ws_test.go
+++ b/ws_test.go
@@ -833,7 +833,11 @@ func TestWSWithTLS(t *testing.T) {
 			// since we used self signed certificates, this should fail without
 			// asking to skip server cert verification.
 			nc, err = Connect(fmt.Sprintf("wss://localhost:%d", sopts.Websocket.Port), copts...)
-			if err == nil || !strings.Contains(err.Error(), "authority") {
+			// Since Go 1.18, we had to regenerate certs to not have to use GODEBUG="x509sha1=1"
+			// But on macOS, with our test CA certs, no SCTs included, it will fail
+			// for the reason "x509: “localhost” certificate is not standards compliant"
+			// instead of "unknown authority".
+			if err == nil || (!strings.Contains(err.Error(), "authority") && !strings.Contains(err.Error(), "compliant")) {
 				if nc != nil {
 					nc.Close()
 				}