MCPcopy
hub / github.com/cortexlabs/cortex / TestRemoveDuplicates

Function TestRemoveDuplicates

pkg/lib/strings/operations_test.go:59–141  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestRemoveDuplicates(t *testing.T) {
60 cases := []struct {
61 name string
62 input []string
63 prefixRegex *regexp.Regexp
64 expected []string
65 }{
66 {
67 name: "abc",
68 input: []string{"a", "b", "a", "b", "a", "a", "a", "c"},
69 expected: []string{"a", "b", "c"},
70 },
71 {
72 name: "nil",
73 input: nil,
74 expected: nil,
75 },
76 {
77 name: "eksctl",
78 prefixRegex: regexp.MustCompile(`^.*[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} \[.+] {2}`),
79 input: []string{
80 "2021-03-26 00:03:50 [ℹ] eksctl version 0.40.0",
81 "2021-03-26 00:03:50 [ℹ] using region us-east-1",
82 "2021-03-26 00:03:50 [ℹ] subnets for us-east-1a - public:192.168.0.0/19 private:192.168.64.0/19",
83 "2021-03-26 00:03:50 [ℹ] subnets for us-east-1b - public:192.168.32.0/19 private:192.168.96.0/19",
84 "2021-03-26 00:03:50 [ℹ] nodegroup \"cx-operator\" will use \"ami-05edded4121b6bde8\" [AmazonLinux2/1.18]",
85 "2021-03-26 00:03:50 [ℹ] nodegroup \"cx-ws-spot\" will use \"ami-05edded4121b6bde8\" [AmazonLinux2/1.18]",
86 "2021-03-26 00:03:50 [ℹ] nodegroup \"cx-wd-cpu\" will use \"ami-05edded4121b6bde8\" [AmazonLinux2/1.18]",
87 "2021-03-26 00:03:51 [ℹ] nodegroup \"cx-wd-gpu\" will use \"ami-00a430391abee258d\" [AmazonLinux2/1.18]",
88 "2021-03-26 00:03:51 [ℹ] nodegroup \"cx-wd-inferentia\" will use \"ami-00a430391abee258d\" [AmazonLinux2/1.18]",
89 "2021-03-26 00:03:51 [ℹ] using Kubernetes version 1.18",
90 "2021-03-26 00:03:51 [ℹ] creating EKS cluster \"cortex\" in \"us-east-1\" region with un-managed nodes",
91 "2021-03-26 00:03:51 [ℹ] 5 nodegroups (cx-operator, cx-wd-cpu, cx-wd-gpu, cx-wd-inferentia, cx-ws-spot) were included (based on the include/exclude rules)",
92 "2021-03-26 00:03:51 [ℹ] will create a CloudFormation stack for cluster itself and 5 nodegroup stack(s)",
93 "2021-03-26 00:03:51 [ℹ] will create a CloudFormation stack for cluster itself and 0 managed nodegroup stack(s)",
94 "2021-03-26 00:03:51 [ℹ] if you encounter any issues, check CloudFormation console or try 'eksctl utils describe-stacks --region=us-east-1 --cluster=cortex'",
95 "2021-03-26 00:03:51 [ℹ] CloudWatch logging will not be enabled for cluster \"cortex\" in \"us-east-1\"",
96 "2021-03-26 00:03:51 [ℹ] you can enable it with 'eksctl utils update-cluster-logging --enable-types={SPECIFY-YOUR-LOG-TYPES-HERE (e.g. all)} --region=us-east-1 --cluster=cortex'",
97 "2021-03-26 00:03:51 [ℹ] Kubernetes API endpoint access will use default of {publicAccess=true, privateAccess=false} for cluster \"cortex\" in \"us-east-1\"",
98 "2021-03-26 00:03:51 [ℹ] 2 sequential tasks: { create cluster control plane \"cortex\", 3 sequential sub-tasks: { 2 sequential sub-tasks: { wait for control plane to become ready, tag cluster }, create addons, 5 parallel sub-tasks: { create nodegroup \"cx-operator\", create nodegroup \"cx-ws-spot\", create nodegroup \"cx-wd-cpu\", create nodegroup \"cx-wd-gpu\", create nodegroup \"cx-wd-inferentia\" } } }",
99 "2021-03-26 00:03:51 [ℹ] building cluster stack \"eksctl-cortex-cluster\"",
100 "2021-03-26 00:03:52 [ℹ] deploying stack \"eksctl-cortex-cluster\"",
101 "2021-03-26 00:03:52 [ℹ] waiting for CloudFormation stack \"eksctl-cortex-cluster\"",
102 "2021-03-26 00:04:09 [ℹ] waiting for CloudFormation stack \"eksctl-cortex-cluster\"",
103 "2021-03-26 00:04:28 [ℹ] waiting for CloudFormation stack \"eksctl-cortex-cluster\"",
104 "2021-03-26 00:04:47 [ℹ] waiting for CloudFormation stack \"eksctl-cortex-cluster\"",
105 "2021-03-26 00:05:07 [ℹ] waiting for CloudFormation stack \"eksctl-cortex-cluster\"",
106 "2021-03-26 00:05:25 [ℹ] waiting for CloudFormation stack \"eksctl-cortex-cluster\"",
107 },
108 expected: []string{
109 "2021-03-26 00:03:50 [ℹ] eksctl version 0.40.0",
110 "2021-03-26 00:03:50 [ℹ] using region us-east-1",
111 "2021-03-26 00:03:50 [ℹ] subnets for us-east-1a - public:192.168.0.0/19 private:192.168.64.0/19",
112 "2021-03-26 00:03:50 [ℹ] subnets for us-east-1b - public:192.168.32.0/19 private:192.168.96.0/19",
113 "2021-03-26 00:03:50 [ℹ] nodegroup \"cx-operator\" will use \"ami-05edded4121b6bde8\" [AmazonLinux2/1.18]",
114 "2021-03-26 00:03:50 [ℹ] nodegroup \"cx-ws-spot\" will use \"ami-05edded4121b6bde8\" [AmazonLinux2/1.18]",
115 "2021-03-26 00:03:50 [ℹ] nodegroup \"cx-wd-cpu\" will use \"ami-05edded4121b6bde8\" [AmazonLinux2/1.18]",
116 "2021-03-26 00:03:51 [ℹ] nodegroup \"cx-wd-gpu\" will use \"ami-00a430391abee258d\" [AmazonLinux2/1.18]",

Callers

nothing calls this directly

Calls 2

RemoveDuplicatesFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected