Control: tags -1 patch fixed-upstream
Control: forwarded -1 https://github.com/go-chef/chef/issues/87

Hi,

In Ubuntu, the attached patch was applied to achieve the following:

  * d/p/fix_intermittent_test_failures.patch: Cherrypick upstream Git commit
    to fix intermittent test failures causing FTBFS.

Thanks for considering the patch.

Logan
diff -Nru 
golang-github-go-chef-chef-0.0.1+git20161023.60.deb8c38/debian/patches/fix_intermittent_test_failures.patch
 
golang-github-go-chef-chef-0.0.1+git20161023.60.deb8c38/debian/patches/fix_intermittent_test_failures.patch
--- 
golang-github-go-chef-chef-0.0.1+git20161023.60.deb8c38/debian/patches/fix_intermittent_test_failures.patch
 1969-12-31 19:00:00.000000000 -0500
+++ 
golang-github-go-chef-chef-0.0.1+git20161023.60.deb8c38/debian/patches/fix_intermittent_test_failures.patch
 2021-01-24 16:27:19.000000000 -0500
@@ -0,0 +1,104 @@
+From b8a5b9cbb7b472eba5c1e2759aa6c288b8251de1 Mon Sep 17 00:00:00 2001
+From: markgibbons <mark.gibb...@nordstrom.com>
+Date: Sat, 7 Dec 2019 07:10:13 -0800
+Subject: [PATCH] Fix the intermittent failures in the String tests
+
+---
+ .circleci/config.yml |  2 +-
+ client_test.go       |  8 +++++---
+ databag_test.go      |  7 +++++--
+ environment_test.go  | 11 +++++++----
+ role_test.go         | 10 ++++++----
+ 5 files changed, 24 insertions(+), 14 deletions(-)
+
+--- a/client_test.go
++++ b/client_test.go
+@@ -36,15 +36,17 @@
+       mux.HandleFunc("/clients", func(w http.ResponseWriter, r *http.Request) 
{
+               fmt.Fprintf(w, `{"client1": "http://localhost/clients/client1";, 
"client2": "http://localhost/clients/client2"}`)
+       })
+-
+       response, err := client.Clients.List()
+       if err != nil {
+               t.Errorf("Clients.List returned error: %v", err)
+       }
+ 
++      // The order printed by the String function is not defined
+       want := "client1 => http://localhost/clients/client1\nclient2 => 
http://localhost/clients/client2\n";
+-      if response.String() != want {
+-              t.Errorf("Clients.List returned:\n%+v\nwant:\n%+v\n", 
response.String(), want)
++      want2 := "client2 => http://localhost/clients/client2\nclient1 => 
http://localhost/clients/client1\n";
++      rstr := response.String()
++      if rstr != want && rstr != want2 {
++              t.Errorf("Clients.List returned:\n%+v\nwant:\n%+v\n", rstr, 
want)
+       }
+ }
+ 
+--- a/databag_test.go
++++ b/databag_test.go
+@@ -157,8 +157,11 @@
+ 
+ func TestDataBagsService_DataBagListResultString(t *testing.T) {
+       e := &DataBagListResult{"bag1": "http://localhost/data/bag1";, "bag2": 
"http://localhost/data/bag2"}
++      // The output order is not guarenteed by the String function, check for 
either order
+       want := "bag1 => http://localhost/data/bag1\nbag2 => 
http://localhost/data/bag2\n";
+-      if e.String() != want {
+-              t.Errorf("DataBagListResult.String 
returned:\n%+v\nwant:\n%+v\n", e.String(), want)
++      want2 := "bag2 => http://localhost/data/bag2\nbag1 => 
http://localhost/data/bag1\n";
++      ebag := e.String()
++      if ebag != want && ebag != want2 {
++              t.Errorf("DataBagListResult.String 
returned:\n%+v\nwant:\n%+v\n", ebag, want)
+       }
+ }
+--- a/environment_test.go
++++ b/environment_test.go
+@@ -143,16 +143,19 @@
+ 
+ func TestEnvironmentsService_EnvironmentListResultString(t *testing.T) {
+       e := &EnvironmentResult{"_default": 
"https://api.opscode.com/organizations/org_name/environments/_default";, 
"webserver": 
"https://api.opscode.com/organizations/org_name/environments/webserver"}
++      estr := e.String()
+       want := "_default => 
https://api.opscode.com/organizations/org_name/environments/_default\nwebserver 
=> https://api.opscode.com/organizations/org_name/environments/webserver\n";
+-      if e.String() != want {
+-              t.Errorf("EnvironmentResult.String 
returned:\n%+v\nwant:\n%+v\n", e.String(), want)
++      want2 := "webserver => 
https://api.opscode.com/organizations/org_name/environments/webserver\n_default 
=> https://api.opscode.com/organizations/org_name/environments/_default\n";
++      if estr != want && estr != want2 {
++              t.Errorf("EnvironmentResult.String 
returned:\n%+v\nwant:\n%+v\n", estr, want)
+       }
+ }
+ 
+ func TestEnvironmentsService_EnvironmentCreateResultString(t *testing.T) {
+       e := &EnvironmentResult{"uri": "http://localhost:4000/environments/dev"}
++      estr := e.String()
+       want := "uri => http://localhost:4000/environments/dev\n";
+-      if e.String() != want {
+-              t.Errorf("EnvironmentResult.String returned %+v, want %+v", 
e.String(), want)
++      if estr != want {
++              t.Errorf("EnvironmentResult.String returned %+v, want %+v", 
estr, want)
+       }
+ }
+--- a/role_test.go
++++ b/role_test.go
+@@ -178,17 +178,19 @@
+ 
+ func TestRolesService_RoleListResultString(t *testing.T) {
+       r := &RoleListResult{"foo": "http://localhost:4000/roles/foo"}
++      rstr := r.String()
+       want := "foo => http://localhost:4000/roles/foo\n";
+-      if r.String() != want {
+-              t.Errorf("RoleListResult.String returned %+v, want %+v", 
r.String(), want)
++      if rstr != want {
++              t.Errorf("RoleListResult.String returned %+v, want %+v", rstr, 
want)
+       }
+ }
+ 
+ func TestRolesService_RoleCreateResultString(t *testing.T) {
+       r := &RoleCreateResult{"uri": "http://localhost:4000/roles/webserver"}
++      rstr := r.String()
+       want := "uri => http://localhost:4000/roles/webserver\n";
+-      if r.String() != want {
+-              t.Errorf("RoleCreateResult.String returned %+v, want %+v", 
r.String(), want)
++      if rstr != want {
++              t.Errorf("RoleCreateResult.String returned %+v, want %+v", 
rstr, want)
+       }
+ }
+ 
diff -Nru 
golang-github-go-chef-chef-0.0.1+git20161023.60.deb8c38/debian/patches/series 
golang-github-go-chef-chef-0.0.1+git20161023.60.deb8c38/debian/patches/series
--- 
golang-github-go-chef-chef-0.0.1+git20161023.60.deb8c38/debian/patches/series   
    2016-11-22 13:02:28.000000000 -0500
+++ 
golang-github-go-chef-chef-0.0.1+git20161023.60.deb8c38/debian/patches/series   
    2021-01-24 16:27:01.000000000 -0500
@@ -1 +1,2 @@
 standalone_ctdk_libs.patch
+fix_intermittent_test_failures.patch

Reply via email to