-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filtering get topology count for specific sc key bug fix (#126)
* Fixing multi-driver-capacity-tracking and adding UT * Updated year in copyright section * Update to fix lint warnings * gofumpt lint fix * adjust test * updating 2024 to 2025 copyright --------- Co-authored-by: Garg <sakshi_garg1@dell.com> Co-authored-by: sakshi-garg1 <74704849+sakshi-garg1@users.noreply.github.com> Co-authored-by: Jooseppi Luna <jooseppi_luna@dell.com>
- Loading branch information
1 parent
9c2d304
commit e1c6a6f
Showing
3 changed files
with
87 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* | ||
* Copyright © 2025 Dell Inc. or its subsidiaries. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package suites | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetTopologyCount(t *testing.T) { | ||
// Test case: Empty topology keys | ||
FindDriverLogs = func(_ []string) (string, error) { | ||
return "", nil | ||
} | ||
topologyCount, err := getTopologyCount([]string{}) | ||
assert.NoError(t, err) | ||
assert.Equal(t, 0, topologyCount) | ||
|
||
// Test case: Non-empty topology keys | ||
|
||
FindDriverLogs = func(_ []string) (string, error) { | ||
keys := "Topology Keys: [csi-powerstore.dellemc.com/1.2.3.4-iscsi csi-powerstore.dellemc.com/1.2.3.4-nfs]" | ||
return keys, nil | ||
} | ||
topologyCount, err = getTopologyCount([]string{"csi-powerstore.dellemc.com/1.2.3.4-iscsi"}) | ||
assert.NoError(t, err) | ||
assert.Equal(t, 1, topologyCount) | ||
|
||
// Test case: Error in FindDriverLogs | ||
FindDriverLogs = func(_ []string) (string, error) { | ||
return "", errors.New("error in FindDriverLogs") | ||
} | ||
topologyCount, err = getTopologyCount([]string{}) | ||
assert.Error(t, err) | ||
assert.Equal(t, 0, topologyCount) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters