nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: google/google-api-python-client
Pull request #443 (2017-09-19 21:27:46)

Warn when google-auth credentials are used but google-auth-httplib2 isn't available


Patch:
diff --git a/googleapiclient/_auth.py b/googleapiclient/_auth.py
index 92f2796f4..ada4ffb15 100644
--- a/googleapiclient/_auth.py
+++ b/googleapiclient/_auth.py
@@ -19,11 +19,15 @@ import httplib2
 try:
     import google.auth
     import google.auth.credentials
-    import google_auth_httplib2
     HAS_GOOGLE_AUTH = True
 except ImportError:  # pragma: NO COVER
     HAS_GOOGLE_AUTH = False
 
+try:
+    import google_auth_httplib2
+except ImportError:  # pragma: NO COVER
+    google_auth_httplib2 = None
+
 try:
     import oauth2client
     import oauth2client.client
@@ -88,6 +92,12 @@ def authorized_http(credentials):
 
     if HAS_GOOGLE_AUTH and isinstance(
             credentials, google.auth.credentials.Credentials):
+        if google_auth_httplib2 is None:
+            raise ValueError(
+                'Credentials from google.auth specified, but '
+                'google-api-python-client is unable to use these credentials '
+                'unless google-auth-httplib2 is installed. Please install '
+                'google-auth-httplib2.')
         return google_auth_httplib2.AuthorizedHttp(credentials,
                                                    http=build_http())
     else:


Test patch:
diff --git a/tests/test__auth.py b/tests/test__auth.py
index 68e7aae6b..003098e65 100644
--- a/tests/test__auth.py
+++ b/tests/test__auth.py
@@ -68,7 +68,9 @@ class TestAuthWithGoogleAuth(unittest2.TestCase):
 
         authorized_http = _auth.authorized_http(credentials)
 
-        self.assertIsInstance(authorized_http, google_auth_httplib2.AuthorizedHttp)
+        self.assertIsInstance(
+            authorized_http,
+            google_auth_httplib2.AuthorizedHttp)
         self.assertEqual(authorized_http.credentials, credentials)
         self.assertIsInstance(authorized_http.http, httplib2.Http)
         self.assertIsInstance(authorized_http.http.timeout, int)
@@ -138,3 +140,16 @@ class TestAuthWithoutAuth(unittest2.TestCase):
     def test_default_credentials(self):
         with self.assertRaises(EnvironmentError):
             print(_auth.default_credentials())
+
+
+class TestGoogleAuthWithoutHttplib2(unittest2.TestCase):
+    def setUp(self):
+        _auth.google_auth_httplib2 = None
+
+    def tearDown(self):
+        _auth.google_auth_httplib2 = google_auth_httplib2
+
+    def test_default_credentials(self):
+        credentials = mock.Mock(spec=google.auth.credentials.Credentials)
+        with self.assertRaises(ValueError):
+            _auth.authorized_http(credentials)
Repository: helm/helm
Pull request #6688 (2019-10-17 18:07:45)

fix(chartutil): restore .Release.Revision
As discussed in the dev call this morning, there are use cases where the release revision was important to chart hooks, such as when the user needs to fetch the correct backup during a rollback operation.

I also added back a missing test case for `.Release.Namespace`.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>



Patch:
diff --git a/pkg/action/install.go b/pkg/action/install.go
index e1a55618d..606226500 100644
--- a/pkg/action/install.go
+++ b/pkg/action/install.go
@@ -200,6 +200,7 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release.
 	options := chartutil.ReleaseOptions{
 		Name:      i.ReleaseName,
 		Namespace: i.Namespace,
+		Revision:  1,
 		IsInstall: true,
 	}
 	valuesToRender, err := chartutil.ToRenderValues(chrt, vals, options, caps)
diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go
index e89ad6050..31fcc1471 100644
--- a/pkg/action/upgrade.go
+++ b/pkg/action/upgrade.go
@@ -147,6 +147,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin
 	options := chartutil.ReleaseOptions{
 		Name:      name,
 		Namespace: currentRelease.Namespace,
+		Revision:  revision,
 		IsUpgrade: true,
 	}
 
diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go
index a6b55701c..d9b94212c 100644
--- a/pkg/chartutil/values.go
+++ b/pkg/chartutil/values.go
@@ -130,6 +130,7 @@ func ReadValuesFile(filename string) (Values, error) {
 type ReleaseOptions struct {
 	Name      string
 	Namespace string
+	Revision  int
 	IsUpgrade bool
 	IsInstall bool
 }
@@ -149,6 +150,7 @@ func ToRenderValues(chrt *chart.Chart, chrtVals map[string]interface{}, options
 			"Namespace": options.Namespace,
 			"IsUpgrade": options.IsUpgrade,
 			"IsInstall": options.IsInstall,
+			"Revision":  options.Revision,
 			"Service":   "Helm",
 		},
 	}


Test patch:
diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go
index 00bcfefed..2cb328d5d 100644
--- a/pkg/chartutil/values_test.go
+++ b/pkg/chartutil/values_test.go
@@ -99,6 +99,8 @@ func TestToRenderValues(t *testing.T) {
 
 	o := ReleaseOptions{
 		Name:      "Seven Voyages",
+		Namespace: "default",
+		Revision:  1,
 		IsInstall: true,
 	}
 
@@ -115,6 +117,12 @@ func TestToRenderValues(t *testing.T) {
 	if name := relmap["Name"]; name.(string) != "Seven Voyages" {
 		t.Errorf("Expected release name 'Seven Voyages', got %q", name)
 	}
+	if namespace := relmap["Namespace"]; namespace.(string) != "default" {
+		t.Errorf("Expected namespace 'default', got %q", namespace)
+	}
+	if revision := relmap["Revision"]; revision.(int) != 1 {
+		t.Errorf("Expected revision '1', got %d", revision)
+	}
 	if relmap["IsUpgrade"].(bool) {
 		t.Error("Expected upgrade to be false.")
 	}
Repository: helm/helm
Pull request #10551 (2022-01-13 15:10:25)

bump version to v3.8.0
This is the PR bumping the internal version as part of the release process


Patch:
diff --git a/internal/version/version.go b/internal/version/version.go
index 201eee359..edf8546f0 100644
--- a/internal/version/version.go
+++ b/internal/version/version.go
@@ -29,7 +29,7 @@ var (
 	//
 	// Increment major number for new feature additions and behavioral changes.
 	// Increment minor number for bug fixes and performance enhancements.
-	version = "v3.7"
+	version = "v3.8"
 
 	// metadata is extra build time data
 	metadata = ""


Test patch:
diff --git a/cmd/helm/testdata/output/version-client-shorthand.txt b/cmd/helm/testdata/output/version-client-shorthand.txt
index 80be7bced..3d82b4b9e 100644
--- a/cmd/helm/testdata/output/version-client-shorthand.txt
+++ b/cmd/helm/testdata/output/version-client-shorthand.txt
@@ -1,1 +1,1 @@
-version.BuildInfo{Version:"v3.7", GitCommit:"", GitTreeState:"", GoVersion:""}
+version.BuildInfo{Version:"v3.8", GitCommit:"", GitTreeState:"", GoVersion:""}
diff --git a/cmd/helm/testdata/output/version-client.txt b/cmd/helm/testdata/output/version-client.txt
index 80be7bced..3d82b4b9e 100644
--- a/cmd/helm/testdata/output/version-client.txt
+++ b/cmd/helm/testdata/output/version-client.txt
@@ -1,1 +1,1 @@
-version.BuildInfo{Version:"v3.7", GitCommit:"", GitTreeState:"", GoVersion:""}
+version.BuildInfo{Version:"v3.8", GitCommit:"", GitTreeState:"", GoVersion:""}
diff --git a/cmd/helm/testdata/output/version-short.txt b/cmd/helm/testdata/output/version-short.txt
index 5a2f3db22..872da761f 100644
--- a/cmd/helm/testdata/output/version-short.txt
+++ b/cmd/helm/testdata/output/version-short.txt
@@ -1,1 +1,1 @@
-v3.7
+v3.8
diff --git a/cmd/helm/testdata/output/version-template.txt b/cmd/helm/testdata/output/version-template.txt
index c501b0bab..c1c5a5604 100644
--- a/cmd/helm/testdata/output/version-template.txt
+++ b/cmd/helm/testdata/output/version-template.txt
@@ -1,1 +1,1 @@
-Version: v3.7
\ No newline at end of file
+Version: v3.8
\ No newline at end of file
diff --git a/cmd/helm/testdata/output/version.txt b/cmd/helm/testdata/output/version.txt
index 80be7bced..3d82b4b9e 100644
--- a/cmd/helm/testdata/output/version.txt
+++ b/cmd/helm/testdata/output/version.txt
@@ -1,1 +1,1 @@
-version.BuildInfo{Version:"v3.7", GitCommit:"", GitTreeState:"", GoVersion:""}
+version.BuildInfo{Version:"v3.8", GitCommit:"", GitTreeState:"", GoVersion:""}
diff --git a/pkg/chartutil/capabilities_test.go b/pkg/chartutil/capabilities_test.go
index c14b6620b..ebc84aadb 100644
--- a/pkg/chartutil/capabilities_test.go
+++ b/pkg/chartutil/capabilities_test.go
@@ -62,8 +62,8 @@ func TestDefaultCapabilities(t *testing.T) {
 func TestDefaultCapabilitiesHelmVersion(t *testing.T) {
 	hv := DefaultCapabilities.HelmVersion
 
-	if hv.Version != "v3.7" {
-		t.Errorf("Expected default HelmVersion to be v3.7, got %q", hv.Version)
+	if hv.Version != "v3.8" {
+		t.Errorf("Expected default HelmVersion to be v3.8, got %q", hv.Version)
 	}
 }
Repository: helm/helm
Pull request #10833 (2022-04-05 09:16:32)

Add priority class to kind sorter
Signed-off-by: Stepan Dohnal <stepan.dohnal@datamole.cz>
Sorting for priority class install/uninstall is not defined and it would be nice to fix this as it leads to error in kube: Error creating: pods "..." is forbidden: no PriorityClass with name ... was found

This issue discusses the feature #10803

this PR contains unit tests



Patch:
diff --git a/pkg/releaseutil/kind_sorter.go b/pkg/releaseutil/kind_sorter.go
index 1d1874cfa..b5d75b88b 100644
--- a/pkg/releaseutil/kind_sorter.go
+++ b/pkg/releaseutil/kind_sorter.go
@@ -29,6 +29,7 @@ type KindSortOrder []string
 //
 // Those occurring earlier in the list get installed before those occurring later in the list.
 var InstallOrder KindSortOrder = []string{
+	"PriorityClass",
 	"Namespace",
 	"NetworkPolicy",
 	"ResourceQuota",
@@ -105,6 +106,7 @@ var UninstallOrder KindSortOrder = []string{
 	"ResourceQuota",
 	"NetworkPolicy",
 	"Namespace",
+	"PriorityClass",
 }
 
 // sort manifests by kind.


Test patch:
diff --git a/pkg/releaseutil/kind_sorter_test.go b/pkg/releaseutil/kind_sorter_test.go
index afcae6d16..9e24c4399 100644
--- a/pkg/releaseutil/kind_sorter_test.go
+++ b/pkg/releaseutil/kind_sorter_test.go
@@ -169,6 +169,10 @@ func TestKindSorter(t *testing.T) {
 			Name: "x",
 			Head: &SimpleHead{Kind: "HorizontalPodAutoscaler"},
 		},
+		{
+			Name: "F",
+			Head: &SimpleHead{Kind: "PriorityClass"},
+		},
 	}
 
 	for _, test := range []struct {
@@ -176,8 +180,8 @@ func TestKindSorter(t *testing.T) {
 		order       KindSortOrder
 		expected    string
 	}{
-		{"install", InstallOrder, "aAbcC3deEf1gh2iIjJkKlLmnopqrxstuUvw!"},
-		{"uninstall", UninstallOrder, "wvUmutsxrqponLlKkJjIi2hg1fEed3CcbAa!"},
+		{"install", InstallOrder, "FaAbcC3deEf1gh2iIjJkKlLmnopqrxstuUvw!"},
+		{"uninstall", UninstallOrder, "wvUmutsxrqponLlKkJjIi2hg1fEed3CcbAaF!"},
 	} {
 		var buf bytes.Buffer
 		t.Run(test.description, func(t *testing.T) {
Repository: helm/helm
Pull request #10945 (2022-05-09 19:20:58)

bump version to v3.9.0


Patch:
diff --git a/internal/version/version.go b/internal/version/version.go
index edf8546f0..6919e29d8 100644
--- a/internal/version/version.go
+++ b/internal/version/version.go
@@ -29,7 +29,7 @@ var (
 	//
 	// Increment major number for new feature additions and behavioral changes.
 	// Increment minor number for bug fixes and performance enhancements.
-	version = "v3.8"
+	version = "v3.9"
 
 	// metadata is extra build time data
 	metadata = ""


Test patch:
diff --git a/cmd/helm/testdata/output/version-client-shorthand.txt b/cmd/helm/testdata/output/version-client-shorthand.txt
index 3d82b4b9e..fc4dde52b 100644
--- a/cmd/helm/testdata/output/version-client-shorthand.txt
+++ b/cmd/helm/testdata/output/version-client-shorthand.txt
@@ -1,1 +1,1 @@
-version.BuildInfo{Version:"v3.8", GitCommit:"", GitTreeState:"", GoVersion:""}
+version.BuildInfo{Version:"v3.9", GitCommit:"", GitTreeState:"", GoVersion:""}
diff --git a/cmd/helm/testdata/output/version-client.txt b/cmd/helm/testdata/output/version-client.txt
index 3d82b4b9e..fc4dde52b 100644
--- a/cmd/helm/testdata/output/version-client.txt
+++ b/cmd/helm/testdata/output/version-client.txt
@@ -1,1 +1,1 @@
-version.BuildInfo{Version:"v3.8", GitCommit:"", GitTreeState:"", GoVersion:""}
+version.BuildInfo{Version:"v3.9", GitCommit:"", GitTreeState:"", GoVersion:""}
diff --git a/cmd/helm/testdata/output/version-short.txt b/cmd/helm/testdata/output/version-short.txt
index 872da761f..c8fc73f81 100644
--- a/cmd/helm/testdata/output/version-short.txt
+++ b/cmd/helm/testdata/output/version-short.txt
@@ -1,1 +1,1 @@
-v3.8
+v3.9
diff --git a/cmd/helm/testdata/output/version-template.txt b/cmd/helm/testdata/output/version-template.txt
index c1c5a5604..e5eba56dc 100644
--- a/cmd/helm/testdata/output/version-template.txt
+++ b/cmd/helm/testdata/output/version-template.txt
@@ -1,1 +1,1 @@
-Version: v3.8
\ No newline at end of file
+Version: v3.9
\ No newline at end of file
diff --git a/cmd/helm/testdata/output/version.txt b/cmd/helm/testdata/output/version.txt
index 3d82b4b9e..fc4dde52b 100644
--- a/cmd/helm/testdata/output/version.txt
+++ b/cmd/helm/testdata/output/version.txt
@@ -1,1 +1,1 @@
-version.BuildInfo{Version:"v3.8", GitCommit:"", GitTreeState:"", GoVersion:""}
+version.BuildInfo{Version:"v3.9", GitCommit:"", GitTreeState:"", GoVersion:""}
diff --git a/pkg/chartutil/capabilities_test.go b/pkg/chartutil/capabilities_test.go
index ebc84aadb..2938f12e3 100644
--- a/pkg/chartutil/capabilities_test.go
+++ b/pkg/chartutil/capabilities_test.go
@@ -62,8 +62,8 @@ func TestDefaultCapabilities(t *testing.T) {
 func TestDefaultCapabilitiesHelmVersion(t *testing.T) {
 	hv := DefaultCapabilities.HelmVersion
 
-	if hv.Version != "v3.8" {
-		t.Errorf("Expected default HelmVersion to be v3.8, got %q", hv.Version)
+	if hv.Version != "v3.9" {
+		t.Errorf("Expected default HelmVersion to be v3.9, got %q", hv.Version)
 	}
 }
Repository: GoogleCloudPlatform/cloud-bigtable-client
Pull request #2057 (2019-01-24 11:31:45)

adding Retry#getStatusCode & unit test
Adding Retry#getStatusCode to be used in BigtableDataSettingFactory for translation of any specific RetryCodes to BigtableDataSettings.


Patch:
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/RetryOptions.java b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/RetryOptions.java
index 2d8515f25..fb102beb7 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/RetryOptions.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/RetryOptions.java
@@ -23,7 +23,6 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.common.collect.ImmutableSet;
 
@@ -337,7 +336,16 @@ public class RetryOptions implements Serializable, Cloneable {
   public boolean isRetryable(Status.Code code) {
     return statusToRetryOn.contains(code);
   }
-  
+
+  /**
+   * Returns {@link Set} of {@link Status.Code} that allow RPC retries.
+   *
+   * @return a {@link Set}.
+   */
+  public Set<Status.Code> getRetryableStatusCodes() {
+    return ImmutableSet.copyOf(statusToRetryOn);
+  }
+
   /** {@inheritDoc} */
   @Override
   public boolean equals(Object obj) {


Test patch:
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/config/TestRetryOptions.java b/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/config/TestRetryOptions.java
index 70666fd85..b57cc0371 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/config/TestRetryOptions.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/config/TestRetryOptions.java
@@ -15,6 +15,7 @@
  */
 package com.google.cloud.bigtable.config;
 
+import com.google.common.collect.ImmutableSet;
 import io.grpc.Status;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -49,5 +50,18 @@ public class TestRetryOptions {
     assertEquals(
         retryOnDeadlineExceeded, options.isRetryable(Status.DEADLINE_EXCEEDED.getCode()));
   }
-}
 
+  @Test
+  public void testGetRetryableStatusCodesWhenDefaultCodes() {
+    RetryOptions options = RetryOptions.getDefaultOptions();
+    assertEquals(RetryOptions.DEFAULT_ENABLE_GRPC_RETRIES_SET, options.getRetryableStatusCodes());
+  }
+
+  @Test
+  public void testGetRetryableStatusCodesWhenDisabledDeadLineExceed() {
+    RetryOptions options = RetryOptions.builder().setRetryOnDeadlineExceeded(false).build();
+    assertEquals(
+        ImmutableSet.of(Status.Code.UNAVAILABLE, Status.Code.ABORTED, Status.Code.UNAUTHENTICATED),
+        options.getRetryableStatusCodes());
+  }
+}