yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/aws/imageowners_test.go (about) 1 // Copyright 2019 Yunion 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package aws 16 17 import ( 18 "regexp" 19 "testing" 20 ) 21 22 func TestImageDistMatch(t *testing.T) { 23 cases := []struct { 24 pattern *regexp.Regexp 25 match string 26 }{ 27 {SUSE_SLES, "suse-sles-11-v20161021-hvm-ssd-x86_64"}, 28 {SUSE_SLES_SP, "suse-sles-11-sp4-v20161021-hvm-ssd-x86_64"}, 29 {SUSE_SLES_RIGHTLINK, "suse-sles-11-rightscale-v20160804-hvm-ssd-x86_64"}, 30 {SUSE_SLES_RIGHTLINK_SP, "suse-sles-11-sp4-rightscale-v20160804-hvm-ssd-x86_64"}, 31 {SUSE_SLES_SAPCAL, "suse-sles-11-sapcal-20150729-hvm-mag-x86_64"}, 32 {SUSE_SLES_SAPCAL_SP, "suse-sles-11-sp4-sapcal-20150729-hvm-mag-x86_64"}, 33 {SUSE_SLES_BYOS, "suse-sles-15-byos-v20180806-hvm-ssd-x86_64"}, 34 {SUSE_SLES_BYOS_SP, "suse-sles-15-sp4-byos-v20180806-hvm-ssd-x86_64"}, 35 {SUSE_SLES_SAP, "suse-sles-sap-12-v20180706-hvm-ssd-x86_64"}, 36 {SUSE_SLES_SAP_SP, "suse-sles-sap-12-sp2-v20180706-hvm-ssd-x86_64"}, 37 {SUSE_SLES_SAP_BYOS, "suse-sles-sap-12-byos-v20180706-hvm-ssd-x86_64"}, 38 {SUSE_SLES_SAP_BYOS_SP, "suse-sles-sap-12-sp2-byos-v20180706-hvm-ssd-x86_64"}, 39 {SUSE_CAASP_CLUSTER_BYOS, "suse-caasp-2-1-cluster-byos-v20180815-hvm-ssd-x86_64"}, 40 {SUSE_CAASP_ADMIN_BYOS, "suse-caasp-2-1-admin-byos-v20180524-hvm-ssd-x86_64"}, 41 {SUSE_MANAGER_SERVER_BYOS, "suse-manager-3-1-server-byos-v20170627-hvm-ssd-x86_64"}, 42 {SUSE_MANAGER_PROXY_BYOS, "suse-manager-3-1-proxy-byos-v20180215-hvm-ssd-x86_64"}, 43 } 44 for _, c := range cases { 45 if !c.pattern.MatchString(c.match) { 46 t.Errorf("not match %s %s", c.pattern, c.match) 47 } 48 } 49 }