Skip to content

Commit 4ec085a

Browse files
committed
fix bug 8170 to support old env var
Signed-off-by: Maxim Rubchinsky <[email protected]>
1 parent e4bac53 commit 4ec085a

File tree

2 files changed

+45
-22
lines changed

2 files changed

+45
-22
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
Copyright 2018 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package utils
18+
19+
import (
20+
"testing"
21+
22+
"github.com/stretchr/testify/assert"
23+
)
24+
25+
func TestFirstNotEmpty(t *testing.T) {
26+
// Test case where the first non-empty string is at the beginning
27+
result := FirstNotEmpty("hello", "world", "test")
28+
assert.Equal(t, "hello", result)
29+
30+
// Test case where the first non-empty string is in the middle
31+
result = FirstNotEmpty("", "foo", "bar")
32+
assert.Equal(t, "foo", result)
33+
34+
// Test case where the first non-empty string is at the end
35+
result = FirstNotEmpty("", "", "baz")
36+
assert.Equal(t, "baz", result)
37+
38+
// Test case where all strings are empty
39+
result = FirstNotEmpty("", "", "")
40+
assert.Equal(t, "", result)
41+
42+
// Test case with no arguments
43+
result = FirstNotEmpty()
44+
assert.Equal(t, "", result)
45+
}

cluster-autoscaler/cloudprovider/alicloud/alicloud_cloud_config_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,3 @@ func TestOldRRSACloudConfigIsValid(t *testing.T) {
5555
assert.True(t, cfg.isValid())
5656
assert.True(t, cfg.RRSAEnabled)
5757
}
58-
59-
func TestFirstNotEmpty(t *testing.T) {
60-
// Test case where the first non-empty string is at the beginning
61-
result := firstNotEmpty("hello", "world", "test")
62-
assert.Equal(t, "hello", result)
63-
64-
// Test case where the first non-empty string is in the middle
65-
result = firstNotEmpty("", "foo", "bar")
66-
assert.Equal(t, "foo", result)
67-
68-
// Test case where the first non-empty string is at the end
69-
result = firstNotEmpty("", "", "baz")
70-
assert.Equal(t, "baz", result)
71-
72-
// Test case where all strings are empty
73-
result = firstNotEmpty("", "", "")
74-
assert.Equal(t, "", result)
75-
76-
// Test case with no arguments
77-
result = firstNotEmpty()
78-
assert.Equal(t, "", result)
79-
}

0 commit comments

Comments
 (0)