From b8461e4b3a69da7053fdd7920f55d9b06733ab5f Mon Sep 17 00:00:00 2001
From: fangyincheng <fangyincheng@sina.com>
Date: Tue, 10 Sep 2019 09:20:26 +0800
Subject: [PATCH] Fix: ut

---
 protocol/dubbo/codec_test.go                  |   4 +-
 .../consul/agent436116882/raft/peers.info     |  65 ++++++++++++++++++
 registry/consul/agent436116882/raft/raft.db   | Bin 0 -> 32768 bytes
 3 files changed, 67 insertions(+), 2 deletions(-)
 create mode 100644 registry/consul/agent436116882/raft/peers.info
 create mode 100644 registry/consul/agent436116882/raft/raft.db

diff --git a/protocol/dubbo/codec_test.go b/protocol/dubbo/codec_test.go
index 8490b0b61..c192c2294 100644
--- a/protocol/dubbo/codec_test.go
+++ b/protocol/dubbo/codec_test.go
@@ -64,11 +64,11 @@ func TestDubboPackage_MarshalAndUnmarshal(t *testing.T) {
 	assert.Equal(t, hessian.PackageRequest, pkgres.Header.Type)
 	assert.Equal(t, byte(S_Dubbo), pkgres.Header.SerialID)
 	assert.Equal(t, int64(10086), pkgres.Header.ID)
-	assert.Equal(t, "2.5.4", pkgres.Body.([]interface{})[0])
+	assert.Equal(t, "2.0.2", pkgres.Body.([]interface{})[0])
 	assert.Equal(t, "path", pkgres.Body.([]interface{})[1])
 	assert.Equal(t, "2.6", pkgres.Body.([]interface{})[2])
 	assert.Equal(t, "Method", pkgres.Body.([]interface{})[3])
 	assert.Equal(t, "Ljava/lang/String;", pkgres.Body.([]interface{})[4])
 	assert.Equal(t, []interface{}{"a"}, pkgres.Body.([]interface{})[5])
-	assert.Equal(t, map[string]string{"group": "", "interface": "Service", "path": "path", "timeout": "1000"}, pkgres.Body.([]interface{})[6])
+	assert.Equal(t, map[string]string{"dubbo": "2.0.2", "group": "", "interface": "Service", "path": "path", "timeout": "1000", "version": "2.6"}, pkgres.Body.([]interface{})[6])
 }
diff --git a/registry/consul/agent436116882/raft/peers.info b/registry/consul/agent436116882/raft/peers.info
new file mode 100644
index 000000000..e8f5885c5
--- /dev/null
+++ b/registry/consul/agent436116882/raft/peers.info
@@ -0,0 +1,65 @@
+
+As of Consul 0.7.0, the peers.json file is only used for recovery
+after an outage. The format of this file depends on what the server has
+configured for its Raft protocol version. Please see the agent configuration
+page at https://www.consul.io/docs/agent/options.html#_raft_protocol for more
+details about this parameter.
+
+For Raft protocol version 2 and earlier, this should be formatted as a JSON
+array containing the address and port of each Consul server in the cluster, like
+this:
+
+[
+  "10.1.0.1:8300",
+  "10.1.0.2:8300",
+  "10.1.0.3:8300"
+]
+
+For Raft protocol version 3 and later, this should be formatted as a JSON
+array containing the node ID, address:port, and suffrage information of each
+Consul server in the cluster, like this:
+
+[
+  {
+    "id": "adf4238a-882b-9ddc-4a9d-5b6758e4159e",
+    "address": "10.1.0.1:8300",
+    "non_voter": false
+  },
+  {
+    "id": "8b6dda82-3103-11e7-93ae-92361f002671",
+    "address": "10.1.0.2:8300",
+    "non_voter": false
+  },
+  {
+    "id": "97e17742-3103-11e7-93ae-92361f002671",
+    "address": "10.1.0.3:8300",
+    "non_voter": false
+  }
+]
+
+The "id" field is the node ID of the server. This can be found in the logs when
+the server starts up, or in the "node-id" file inside the server's data
+directory.
+
+The "address" field is the address and port of the server.
+
+The "non_voter" field controls whether the server is a non-voter, which is used
+in some advanced Autopilot configurations, please see
+https://www.consul.io/docs/guides/autopilot.html for more information. If
+"non_voter" is omitted it will default to false, which is typical for most
+clusters.
+
+Under normal operation, the peers.json file will not be present.
+
+When Consul starts for the first time, it will create this peers.info file and
+delete any existing peers.json file so that recovery doesn't occur on the first
+startup.
+
+Once this peers.info file is present, any peers.json file will be ingested at
+startup, and will set the Raft peer configuration manually to recover from an
+outage. It's crucial that all servers in the cluster are shut down before
+creating the peers.json file, and that all servers receive the same
+configuration. Once the peers.json file is successfully ingested and applied, it
+will be deleted.
+
+Please see https://www.consul.io/docs/guides/outage.html for more information.
diff --git a/registry/consul/agent436116882/raft/raft.db b/registry/consul/agent436116882/raft/raft.db
new file mode 100644
index 0000000000000000000000000000000000000000..280e025bb8d029da6f21e4784130859ab41caf40
GIT binary patch
literal 32768
zcmeI)yKcfT6adgbDHBqeVd>O~4fqEJmVQGeSa=Mb;8XdBbnk`@z5@t`N|Bo3M2h^#
zjbokd+E%LSdi6?Kp9Xa|*N3<L<#F{|D*aMkVpDxL9Z!zi-=Bz65+Fc;009C72oNAZ
zfB*pk?GfmdsXWX7U+$(F`F_O5`)`ZG=V-qCxC_@LK!5-N0t5&UAV7cs0RjYCAQ1U{
z+3s(_j7)(50RjXF5FkK+009C72oPvmAollT9iZv)jYoh00RjXF5FkK+009C72>ic5
zoa66S*A;+#p8q}Fxj&b=Jxh1AzxKOTYCgPT4Pmoie?JUJoe}fwxqbo!2oNAZfB*pk
z1PBlyK%jYn_@CdfWag2d$GL#!zi31P1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
d2oNAZfB*pk1PBlyK!5-N0t5&UAVA=+0%vm(519Y}

literal 0
HcmV?d00001

-- 
GitLab