-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Streamline stack naming This cleans up the stack nameing code a bit and introduces a new naming format that should work in all cases: ``` ingress-alb-<clusterID>-<UUID> ``` This naming convention will not affect existing ALB stacks, it's only applied to new stacks. Fix #144 * Use kube-ingress-aws-controller as stack name prefix * Add simple tests for normalizeStackName
- Loading branch information
1 parent
83b5e37
commit 64b2721
Showing
2 changed files
with
35 additions
and
10 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,25 @@ | ||
package aws | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestNormalizeStackName(t *testing.T) { | ||
// test simple cluster ID | ||
clusterID := "my-cluster" | ||
normalized := normalizeStackName(clusterID) | ||
expectedPrefix := stackNamePrefix + nameSeparator + clusterID + nameSeparator | ||
if !strings.HasPrefix(normalized, expectedPrefix) { | ||
t.Errorf("expected prefix %s, got %s", expectedPrefix, normalized) | ||
} | ||
|
||
// test that very long cluster ID gets cut off | ||
longClusterID := strings.Repeat("a", maxStackNameLen) | ||
normalized = normalizeStackName(longClusterID) | ||
expectedClusterID := strings.Repeat("a", maxStackNameLen-len(stackNamePrefix)-uuidLen-2) | ||
expectedPrefix = stackNamePrefix + nameSeparator + expectedClusterID + nameSeparator | ||
if !strings.HasPrefix(normalized, expectedPrefix) { | ||
t.Errorf("expected prefix %s, got %s", expectedPrefix, normalized) | ||
} | ||
} |