nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: spotahome/redis-operator
Pull request #415 (2022-06-18 11:32:51)

fix bug that svc not update when crd changed
Fixes # . https://github.com/spotahome/redis-operator/issues/400

Changes proposed on the PR:
- 
- 
- 


Patch:
diff --git a/operator/redisfailover/service/client.go b/operator/redisfailover/service/client.go
index adabc418..235d2c3d 100644
--- a/operator/redisfailover/service/client.go
+++ b/operator/redisfailover/service/client.go
@@ -49,7 +49,7 @@ func generateSelectorLabels(component, name string) map[string]string {
 // EnsureSentinelService makes sure the sentinel service exists
 func (r *RedisFailoverKubeClient) EnsureSentinelService(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error {
 	svc := generateSentinelService(rf, labels, ownerRefs)
-	return r.K8SService.CreateIfNotExistsService(rf.Namespace, svc)
+	return r.K8SService.CreateOrUpdateService(rf.Namespace, svc)
 }
 
 // EnsureSentinelConfigMap makes sure the sentinel configmap exists
@@ -110,7 +110,7 @@ func (r *RedisFailoverKubeClient) EnsureRedisReadinessConfigMap(rf *redisfailove
 // EnsureRedisService makes sure the redis statefulset exists
 func (r *RedisFailoverKubeClient) EnsureRedisService(rf *redisfailoverv1.RedisFailover, labels map[string]string, ownerRefs []metav1.OwnerReference) error {
 	svc := generateRedisService(rf, labels, ownerRefs)
-	return r.K8SService.CreateIfNotExistsService(rf.Namespace, svc)
+	return r.K8SService.CreateOrUpdateService(rf.Namespace, svc)
 }
 
 // EnsureNotPresentRedisService makes sure the redis service is not present


Test patch:
diff --git a/operator/redisfailover/service/generator_test.go b/operator/redisfailover/service/generator_test.go
index eada6f7a..cc51723d 100644
--- a/operator/redisfailover/service/generator_test.go
+++ b/operator/redisfailover/service/generator_test.go
@@ -1029,7 +1029,7 @@ func TestSentinelService(t *testing.T) {
 			generatedService := corev1.Service{}
 
 			ms := &mK8SService.Services{}
-			ms.On("CreateIfNotExistsService", rf.Namespace, mock.Anything).Once().Run(func(args mock.Arguments) {
+			ms.On("CreateOrUpdateService", rf.Namespace, mock.Anything).Once().Run(func(args mock.Arguments) {
 				s := args.Get(1).(*corev1.Service)
 				generatedService = *s
 			}).Return(nil)
@@ -1277,7 +1277,7 @@ func TestRedisService(t *testing.T) {
 			generatedService := corev1.Service{}
 
 			ms := &mK8SService.Services{}
-			ms.On("CreateIfNotExistsService", rf.Namespace, mock.Anything).Once().Run(func(args mock.Arguments) {
+			ms.On("CreateOrUpdateService", rf.Namespace, mock.Anything).Once().Run(func(args mock.Arguments) {
 				s := args.Get(1).(*corev1.Service)
 				generatedService = *s
 			}).Return(nil)
Repository: Wikidata/Wikidata-Toolkit
Pull request #686 (2022-04-30 06:57:07)

Fixup: content-type of POST requests with files
With more testing I discovered that it is  important that the content disposition of the POST data is `multipart/form-data`, and not `multipart/mixed`, when uploading files to a MediaWiki API endpoint.


Patch:
diff --git a/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java b/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java
index 15c6c148..8b515e16 100644
--- a/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java
+++ b/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java
@@ -169,7 +169,7 @@ public abstract class ApiConnection {
 	}
 
 	/**
-	 * Subclasses can customized their own {@link OkHttpClient.Builder} instances.
+	 * Subclasses can customize their own {@link OkHttpClient.Builder} instances.
 	 *
 	 * An example:
 	 * <pre>
@@ -434,12 +434,14 @@ public abstract class ApiConnection {
 		} else if ("POST".equalsIgnoreCase(requestMethod)) {
 			RequestBody body;
 			if (files != null && !files.isEmpty()) {
+				MediaType formDataMediaType = MediaType.parse("multipart/form-data");
 				MultipartBody.Builder builder = new MultipartBody.Builder();
+				builder.setType(formDataMediaType);
 				parameters.entrySet().stream()
 					.forEach(entry -> builder.addFormDataPart(entry.getKey(), entry.getValue()));
 				files.entrySet().stream()
 					.forEach(entry -> builder.addFormDataPart(entry.getKey(), entry.getValue().getLeft(),
-							RequestBody.create(MediaType.parse("application/octet-stream"),entry.getValue().getRight())));
+							RequestBody.create(formDataMediaType,entry.getValue().getRight())));
 				body = builder.build();
 			} else {
 				body = RequestBody.create(queryString, URLENCODED_MEDIA_TYPE);


Test patch:
diff --git a/wdtk-wikibaseapi/src/test/java/org/wikidata/wdtk/wikibaseapi/BasicApiConnectionTest.java b/wdtk-wikibaseapi/src/test/java/org/wikidata/wdtk/wikibaseapi/BasicApiConnectionTest.java
index 04b8f469..13763b42 100644
--- a/wdtk-wikibaseapi/src/test/java/org/wikidata/wdtk/wikibaseapi/BasicApiConnectionTest.java
+++ b/wdtk-wikibaseapi/src/test/java/org/wikidata/wdtk/wikibaseapi/BasicApiConnectionTest.java
@@ -103,7 +103,8 @@ public class BasicApiConnectionTest {
 					String requestBody = request.getBody().readUtf8();
 					// in the case of file uploads, the string representation of the request body is not stable
 					// so we only check that some file was uploaded (for testPostFile)
-					if (requestBody.contains("Content-Disposition: form-data; name=\"file\"; filename=\"hello.txt\"")) {
+					if (requestBody.contains("Content-Disposition: form-data; name=\"file\"; filename=\"hello.txt\"") &&
+							requestBody.contains("multipart/form-data")) {
 						return new MockResponse()
 								.setHeader("Content-Type", "application/json; charset=utf-8")
 								.setBody("{\"success\":\"true\"}");
Repository: census-instrumentation/opencensus-python
Pull request #183 (2018-05-25 00:12:24)

Stats: fix a bug in MeasurementMap.


Patch:
diff --git a/opencensus/stats/measurement_map.py b/opencensus/stats/measurement_map.py
index 8085082..89bde8c 100644
--- a/opencensus/stats/measurement_map.py
+++ b/opencensus/stats/measurement_map.py
@@ -50,7 +50,7 @@ class MeasurementMap(object):
     def record(self, tag_map_tags):
         """records all the measures at the same time with an explicit tag_map
         """
-        self.measure_to_view_map.MeasureToViewMap.record(
+        self.measure_to_view_map.record(
                 tags=tag_map_tags,
                 stats=self.measurement_map,
                 timestamp=datetime.utcnow().isoformat() + 'Z'


Test patch:
diff --git a/tests/unit/stats/test_measurement_map.py b/tests/unit/stats/test_measurement_map.py
index b91bd5f..fc4ab57 100644
--- a/tests/unit/stats/test_measurement_map.py
+++ b/tests/unit/stats/test_measurement_map.py
@@ -56,4 +56,4 @@ class TestMeasurementMap(unittest.TestCase):
 
         tags = {'testtag1': 'testtag1val'}
         measurement_map.record(tag_map_tags=tags)
-        self.assertTrue(measure_to_view_map.MeasureToViewMap.record.called)
+        self.assertTrue(measure_to_view_map.record.called)
Repository: census-instrumentation/opencensus-python
Pull request #258 (2018-08-14 19:01:44)

Stats: Allow recording against implicit tag_map.
Fixes https://github.com/census-instrumentation/opencensus-python/issues/254.

songy23: Thanks!

Patch:
diff --git a/opencensus/stats/measurement_map.py b/opencensus/stats/measurement_map.py
index 37d6828..5bbe8e9 100644
--- a/opencensus/stats/measurement_map.py
+++ b/opencensus/stats/measurement_map.py
@@ -13,6 +13,7 @@
 # limitations under the License.
 
 from datetime import datetime
+from opencensus.tags import execution_context
 
 
 class MeasurementMap(object):
@@ -47,8 +48,10 @@ class MeasurementMap(object):
         """associates the measure of type Float with the given value"""
         self._measurement_map[measure] = value
 
-    def record(self, tag_map_tags):
-        """records all the measures at the same time with an explicit tag_map
+    def record(self, tag_map_tags=execution_context.get_current_tag_map()):
+        """records all the measures at the same time with a tag_map.
+        tag_map could either be explicitly passed to the method, or implicitly
+        read from current execution context.
         """
         self.measure_to_view_map.record(
                 tags=tag_map_tags,


Test patch:
diff --git a/tests/unit/stats/test_measurement_map.py b/tests/unit/stats/test_measurement_map.py
index fc4ab57..6d125dc 100644
--- a/tests/unit/stats/test_measurement_map.py
+++ b/tests/unit/stats/test_measurement_map.py
@@ -16,6 +16,7 @@ import unittest
 import mock
 from opencensus.stats import measurement_map as measurement_map_module
 from opencensus.stats.measure_to_view_map import MeasureToViewMap
+from opencensus.tags import execution_context
 
 
 class TestMeasurementMap(unittest.TestCase):
@@ -49,7 +50,7 @@ class TestMeasurementMap(unittest.TestCase):
 
         self.assertEqual({'testKey': 1.0}, measurement_map.measurement_map)
 
-    def test_record(self):
+    def test_record_against_explicit_tag_map(self):
         measure_to_view_map = mock.Mock()
         measurement_map = measurement_map_module.MeasurementMap(
             measure_to_view_map=measure_to_view_map)
@@ -57,3 +58,13 @@ class TestMeasurementMap(unittest.TestCase):
         tags = {'testtag1': 'testtag1val'}
         measurement_map.record(tag_map_tags=tags)
         self.assertTrue(measure_to_view_map.record.called)
+
+    def test_record_against_implicit_tag_map(self):
+        measure_to_view_map = mock.Mock()
+        measurement_map = measurement_map_module.MeasurementMap(
+            measure_to_view_map=measure_to_view_map)
+
+        tags = {'testtag1': 'testtag1val'}
+        execution_context.set_current_tag_map(tags)
+        measurement_map.record()
+        self.assertTrue(measure_to_view_map.record.called)
Repository: nats-io/nats-server
Pull request #2539 (2021-09-16 22:59:12)

Exposing reserved memory in jsz/varz
Signed-off-by: Matthias Hanel <mh@synadia.com>

@wallyqs this probably needs to make it into prometheus


Patch:
diff --git a/server/jetstream.go b/server/jetstream.go
index 4e12637d..8dd92dee 100644
--- a/server/jetstream.go
+++ b/server/jetstream.go
@@ -49,10 +49,12 @@ type JetStreamConfig struct {
 }
 
 type JetStreamStats struct {
-	Memory   uint64            `json:"memory"`
-	Store    uint64            `json:"storage"`
-	Accounts int               `json:"accounts,omitempty"`
-	API      JetStreamAPIStats `json:"api"`
+	Memory         uint64            `json:"memory"`
+	Store          uint64            `json:"storage"`
+	Accounts       int               `json:"accounts,omitempty"`
+	API            JetStreamAPIStats `json:"api"`
+	ReservedMemory uint64            `json:"reserved_memory"`
+	ReservedStore  uint64            `json:"reserved_storage"`
 }
 
 type JetStreamAccountLimits struct {
@@ -1645,6 +1647,8 @@ func (js *jetStream) usageStats() *JetStreamStats {
 	var stats JetStreamStats
 	js.mu.RLock()
 	stats.Accounts = len(js.accounts)
+	stats.ReservedMemory = (uint64)(js.memReserved)
+	stats.ReservedStore = (uint64)(js.storeReserved)
 	js.mu.RUnlock()
 	stats.API.Total = (uint64)(atomic.LoadInt64(&js.apiCalls))
 	stats.API.Errors = (uint64)(atomic.LoadInt64(&js.apiErrors))


Test patch:
diff --git a/server/monitor_test.go b/server/monitor_test.go
index 2f267349..9c932c3d 100644
--- a/server/monitor_test.go
+++ b/server/monitor_test.go
@@ -3959,7 +3959,7 @@ func TestMonitorJsz(t *testing.T) {
 			}
 			ACC {
 				users [{user: usr, password: pwd}]
-				jetstream: enabled
+				jetstream: {max_store: 4Mb, max_memory: 5Mb}
 			}
 			BCC_TO_HAVE_ONE_EXTRA {
 				users [{user: usr2, password: pwd}]
@@ -4034,6 +4034,12 @@ func TestMonitorJsz(t *testing.T) {
 			if info.Messages != 1 {
 				t.Fatalf("expected one message but got %d", info.Messages)
 			}
+			if info.ReservedStore != 4*1024*1024 {
+				t.Fatalf("expected 4Mb reserved, got %d bytes", info.ReservedStore)
+			}
+			if info.ReservedMemory != 5*1024*1024 {
+				t.Fatalf("expected 5Mb reserved, got %d bytes", info.ReservedStore)
+			}
 		}
 	})
 	t.Run("accounts", func(t *testing.T) {
Repository: nats-io/nats-server
Pull request #3344 (2022-08-05 19:20:04)

Remove io/ioutil
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>



Patch:
diff --git a/server/jetstream.go b/server/jetstream.go
index 7ee78dce..f96c3b59 100644
--- a/server/jetstream.go
+++ b/server/jetstream.go
@@ -694,7 +694,7 @@ func (s *Server) configAllJetStreamAccounts() error {
 		// clustered stream removal will perform this cleanup as well
 		// this is mainly for initial cleanup
 		saccName := s.sys.account.Name
-		accStoreDirs, _ := ioutil.ReadDir(js.config.StoreDir)
+		accStoreDirs, _ := os.ReadDir(js.config.StoreDir)
 		for _, acc := range accStoreDirs {
 			if accName := acc.Name(); accName != saccName {
 				// no op if not empty


Test patch:
diff --git a/server/jetstream_cluster_test.go b/server/jetstream_cluster_test.go
index b6ff811c..401ef0d9 100644
--- a/server/jetstream_cluster_test.go
+++ b/server/jetstream_cluster_test.go
@@ -23,7 +23,6 @@ import (
 	"encoding/hex"
 	"encoding/json"
 	"fmt"
-	"io/ioutil"
 	"math/rand"
 	"os"
 	"path/filepath"
@@ -3784,10 +3783,10 @@ func TestJetStreamClusterAccountPurge(t *testing.T) {
 		sysDirs := 0
 		accDirs := 0
 		for _, s := range c.servers {
-			files, err := ioutil.ReadDir(s.getOpts().StoreDir + "/jetstream/" + syspub + "/_js_/")
+			files, err := os.ReadDir(s.getOpts().StoreDir + "/jetstream/" + syspub + "/_js_/")
 			require_NoError(t, err)
 			sysDirs += len(files) - 1 // sub 1 for _meta_
-			files, err = ioutil.ReadDir(s.getOpts().StoreDir + "/jetstream/" + accpub + "/streams/")
+			files, err = os.ReadDir(s.getOpts().StoreDir + "/jetstream/" + accpub + "/streams/")
 			if err == nil || (err != nil && err.(*os.PathError).Error() == "no such file or directory") {
 				accDirs += len(files)
 			}
@@ -3932,10 +3931,10 @@ func TestJetStreamAccountPurge(t *testing.T) {
 	inspectDirs := func(t *testing.T, accTotal int) error {
 		t.Helper()
 		if accTotal == 0 {
-			files, err := ioutil.ReadDir(o.StoreDir + "/jetstream/" + accpub)
+			files, err := os.ReadDir(o.StoreDir + "/jetstream/" + accpub)
 			require_True(t, len(files) == accTotal || err != nil)
 		} else {
-			files, err := ioutil.ReadDir(o.StoreDir + "/jetstream/" + accpub + "/streams")
+			files, err := os.ReadDir(o.StoreDir + "/jetstream/" + accpub + "/streams")
 			require_NoError(t, err)
 			require_True(t, len(files) == accTotal)
 		}
Repository: nats-io/nats-server
Pull request #3388 (2022-08-22 19:18:48)

Reduce length of some clustering tests
Since PR #3381, the 2 tests modified here would take twice as
long (around 245 seconds) to complete.
Talking with Matthias, he suggested using a variable instead of
a const and set it to 0 for those 2 tests since they don't really
need that to be set.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>



Patch:
diff --git a/server/jetstream_cluster.go b/server/jetstream_cluster.go
index 6488436f..8dfd788e 100644
--- a/server/jetstream_cluster.go
+++ b/server/jetstream_cluster.go
@@ -1633,8 +1633,10 @@ func currentPeerCount(ci *ClusterInfo, peerSet []string, leaderId string) (curre
 	return
 }
 
+const defaultScaleDownDelayTicks = 2
+
 // how many migration tracker ticks of delay to induce
-const scaleDownDelayTicks = 2
+var scaleDownDelayTicks = defaultScaleDownDelayTicks
 
 // Monitor our stream node for this stream.
 func (js *jetStream) monitorStream(mset *stream, sa *streamAssignment, sendSnapshot bool) {


Test patch:
diff --git a/server/jetstream_super_cluster_test.go b/server/jetstream_super_cluster_test.go
index 6d8862e0..fbd976fe 100644
--- a/server/jetstream_super_cluster_test.go
+++ b/server/jetstream_super_cluster_test.go
@@ -2869,6 +2869,10 @@ func TestJetStreamSuperClusterMoveCancel(t *testing.T) {
 }
 
 func TestJetStreamSuperClusterDoubleStreamMove(t *testing.T) {
+	// Shorten this test by factor of 2.
+	scaleDownDelayTicks = 0
+	defer func() { scaleDownDelayTicks = defaultScaleDownDelayTicks }()
+
 	server := map[string]struct{}{}
 	sc := createJetStreamSuperClusterWithTemplateAndModHook(t, jsClusterTempl, 4, 2,
 		func(serverName, clusterName, storeDir, conf string) string {
@@ -3069,6 +3073,10 @@ func TestJetStreamSuperClusterDoubleStreamMove(t *testing.T) {
 }
 
 func TestJetStreamSuperClusterPeerEvacuationAndStreamReassignment(t *testing.T) {
+	// Shorten this test by factor of 2.
+	scaleDownDelayTicks = 0
+	defer func() { scaleDownDelayTicks = defaultScaleDownDelayTicks }()
+
 	s := createJetStreamSuperClusterWithTemplateAndModHook(t, jsClusterTempl, 4, 2,
 		func(serverName, clusterName, storeDir, conf string) string {
 			return fmt.Sprintf("%s\nserver_tags: [cluster:%s, server:%s]", conf, clusterName, serverName)
Repository: nats-io/nats-server
Pull request #2671 (2021-11-03 12:35:49)

Allow system account to respond with jetstream not enabled.
Makes interactions with nats cli a bit better.

Signed-off-by: Derek Collison <derek@nats.io>

/cc @nats-io/core



Patch:
diff --git a/server/jetstream_api.go b/server/jetstream_api.go
index 47caf39b..5b839b61 100644
--- a/server/jetstream_api.go
+++ b/server/jetstream_api.go
@@ -270,7 +270,8 @@ type ApiResponse struct {
 	Error *ApiError `json:"error,omitempty"`
 }
 
-// ToError checks if the response has a error and if it does converts it to an error avoiding the pitfalls described by https://yourbasic.org/golang/gotcha-why-nil-error-not-equal-nil/
+// ToError checks if the response has a error and if it does converts it to an error avoiding
+// the pitfalls described by https://yourbasic.org/golang/gotcha-why-nil-error-not-equal-nil/
 func (r *ApiResponse) ToError() error {
 	if r.Error == nil {
 		return nil
@@ -607,14 +608,18 @@ const defaultMaxJSApiOut = int64(4096)
 var maxJSApiOut = defaultMaxJSApiOut
 
 func (js *jetStream) apiDispatch(sub *subscription, c *client, acc *Account, subject, reply string, rmsg []byte) {
-	hdr, _ := c.msgParts(rmsg)
-	if len(getHeader(ClientInfoHdr, hdr)) == 0 {
-		return
-	}
 	js.mu.RLock()
 	s, rr := js.srv, js.apiSubs.Match(subject)
 	js.mu.RUnlock()
 
+	hdr, _ := c.msgParts(rmsg)
+	if len(getHeader(ClientInfoHdr, hdr)) == 0 {
+		// Check of this is the system account. We will let these through.
+		if s.SystemAccount() != acc {
+			return
+		}
+	}
+
 	// Shortcircuit.
 	if len(rr.psubs)+len(rr.qsubs) == 0 {
 		return


Test patch:
diff --git a/server/jetstream_cluster_test.go b/server/jetstream_cluster_test.go
index 9343936c..78b6b572 100644
--- a/server/jetstream_cluster_test.go
+++ b/server/jetstream_cluster_test.go
@@ -9427,6 +9427,19 @@ func TestJetStreamClusterKVMultipleConcurrentCreate(t *testing.T) {
 	time.Sleep(time.Second)
 }
 
+func TestJetStreamClusterAccountInfoForSystemAccount(t *testing.T) {
+	c := createJetStreamClusterExplicit(t, "R3S", 3)
+	defer c.shutdown()
+
+	// Client based API
+	nc, js := jsClientConnect(t, c.randomServer(), nats.UserInfo("admin", "s3cr3t!"))
+	defer nc.Close()
+
+	if _, err := js.AccountInfo(); err != nats.ErrJetStreamNotEnabled {
+		t.Fatalf("Expected a not enabled error for system account, got %v", err)
+	}
+}
+
 // Support functions
 
 // Used to setup superclusters for tests.
Repository: nats-io/nats-server
Pull request #2696 (2021-11-17 14:19:28)

support always presenting a nonce to clients
The nonce feature is useful to custom authentication plugins
but at present there is no way to enable a nonce to be presented
other than by setting nkey accounts etc.

This enables the nonce to always be presented in those situations.
Since its primarily useful to embedded scenarios there is no corresponding
configuration file behavior for this flag.

Signed-off-by: R.I.Pienaar <rip@devco.net>

/cc @nats-io/core



Patch:
diff --git a/server/nkey.go b/server/nkey.go
index 87b20a4f..61eac1af 100644
--- a/server/nkey.go
+++ b/server/nkey.go
@@ -33,7 +33,7 @@ func (s *Server) NonceRequired() bool {
 // nonceRequired tells us if we should send a nonce.
 // Lock should be held on entry.
 func (s *Server) nonceRequired() bool {
-	return len(s.nkeys) > 0 || s.trustedKeys != nil
+	return s.opts.AlwaysEnableNonce || len(s.nkeys) > 0 || s.trustedKeys != nil
 }
 
 // Generate a nonce for INFO challenge.
diff --git a/server/opts.go b/server/opts.go
index 6a3e37a8..0d82f14d 100644
--- a/server/opts.go
+++ b/server/opts.go
@@ -262,6 +262,11 @@ type Options struct {
 	AccountResolver          AccountResolver       `json:"-"`
 	AccountResolverTLSConfig *tls.Config           `json:"-"`
 
+	// AlwaysEnableNonce will always present a nonce to new connections
+	// typically used by custom Authentication implementations who embeds
+	// the server and so not presented as a configuration option
+	AlwaysEnableNonce bool
+
 	CustomClientAuthentication Authentication `json:"-"`
 	CustomRouterAuthentication Authentication `json:"-"`
 


Test patch:
diff --git a/server/nkey_test.go b/server/nkey_test.go
index b11954a0..2a5a7cc1 100644
--- a/server/nkey_test.go
+++ b/server/nkey_test.go
@@ -54,6 +54,28 @@ func mixedSetup() (*Server, *testAsyncClient, *bufio.Reader, string) {
 	return rawSetup(opts)
 }
 
+func TestServerInfoNonceAlwaysEnabled(t *testing.T) {
+	opts := defaultServerOptions
+	opts.AlwaysEnableNonce = true
+	s, c, _, l := rawSetup(opts)
+	defer s.WaitForShutdown()
+	defer s.Shutdown()
+	defer c.close()
+
+	if !strings.HasPrefix(l, "INFO ") {
+		t.Fatalf("INFO response incorrect: %s\n", l)
+	}
+
+	var info nonceInfo
+	err := json.Unmarshal([]byte(l[5:]), &info)
+	if err != nil {
+		t.Fatalf("Could not parse INFO json: %v\n", err)
+	}
+	if info.Nonce == "" {
+		t.Fatalf("Expected a non-empty nonce with AlwaysEnableNonce set")
+	}
+}
+
 func TestServerInfoNonce(t *testing.T) {
 	c, l := setUpClientWithResponse()
 	defer c.close()