github.com/swisscom/cloudfoundry-cli@v7.1.0+incompatible/actor/v2action/space_summary_test.go (about)

     1  package v2action_test
     2  
     3  import (
     4  	"errors"
     5  
     6  	. "code.cloudfoundry.org/cli/actor/v2action"
     7  	"code.cloudfoundry.org/cli/actor/v2action/v2actionfakes"
     8  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2"
     9  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/constant"
    10  	. "github.com/onsi/ginkgo"
    11  	. "github.com/onsi/gomega"
    12  )
    13  
    14  var _ = Describe("Space Summary Actions", func() {
    15  	Describe("GetSpaceSummaryByOrganizationAndName", func() {
    16  		var (
    17  			actor                     *Actor
    18  			fakeCloudControllerClient *v2actionfakes.FakeCloudControllerClient
    19  			spaceSummary              SpaceSummary
    20  			warnings                  Warnings
    21  			err                       error
    22  		)
    23  
    24  		BeforeEach(func() {
    25  			fakeCloudControllerClient = new(v2actionfakes.FakeCloudControllerClient)
    26  			actor = NewActor(fakeCloudControllerClient, nil, nil)
    27  		})
    28  
    29  		When("space staging security groups are requested", func() {
    30  			JustBeforeEach(func() {
    31  				spaceSummary, warnings, err = actor.GetSpaceSummaryByOrganizationAndName("some-org-guid", "some-space")
    32  			})
    33  
    34  			When("no errors are encountered", func() {
    35  				BeforeEach(func() {
    36  					fakeCloudControllerClient.GetOrganizationReturns(
    37  						ccv2.Organization{
    38  							GUID: "some-org-guid",
    39  							Name: "some-org",
    40  						},
    41  						ccv2.Warnings{"warning-1", "warning-2"},
    42  						nil)
    43  
    44  					fakeCloudControllerClient.GetSpacesReturns(
    45  						[]ccv2.Space{
    46  							{
    47  								GUID:                     "some-space-guid",
    48  								Name:                     "some-space",
    49  								SpaceQuotaDefinitionGUID: "some-space-quota-guid",
    50  							},
    51  						},
    52  						ccv2.Warnings{"warning-3", "warning-4"},
    53  						nil)
    54  
    55  					fakeCloudControllerClient.GetApplicationsReturns(
    56  						[]ccv2.Application{
    57  							{
    58  								Name: "some-app-2",
    59  							},
    60  							{
    61  								Name: "some-app-1",
    62  							},
    63  						},
    64  						ccv2.Warnings{"warning-5", "warning-6"},
    65  						nil)
    66  
    67  					fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
    68  						[]ccv2.ServiceInstance{
    69  							{
    70  								GUID: "some-service-instance-guid-2",
    71  								Name: "some-service-instance-2",
    72  							},
    73  							{
    74  								GUID: "some-service-instance-guid-1",
    75  								Name: "some-service-instance-1",
    76  							},
    77  						},
    78  						ccv2.Warnings{"warning-7", "warning-8"},
    79  						nil)
    80  
    81  					fakeCloudControllerClient.GetSpaceQuotaDefinitionReturns(
    82  						ccv2.SpaceQuota{
    83  							GUID: "some-space-quota-guid",
    84  							Name: "some-space-quota",
    85  						},
    86  						ccv2.Warnings{"warning-9", "warning-10"},
    87  						nil)
    88  
    89  					fakeCloudControllerClient.GetSpaceSecurityGroupsReturns(
    90  						[]ccv2.SecurityGroup{
    91  							{
    92  								Name: "some-shared-security-group",
    93  								Rules: []ccv2.SecurityGroupRule{
    94  									{
    95  										Description: "Some shared walking group",
    96  										Destination: "0.0.0.0-5.6.7.8",
    97  										Ports:       "80,443",
    98  										Protocol:    "tcp",
    99  									},
   100  									{
   101  										Description: "Some shared walking group too",
   102  										Destination: "127.10.10.10-127.10.10.255",
   103  										Ports:       "80,4443",
   104  										Protocol:    "udp",
   105  									},
   106  								},
   107  							},
   108  							{
   109  								Name: "some-running-security-group",
   110  								Rules: []ccv2.SecurityGroupRule{
   111  									{
   112  										Description: "Some running walking group",
   113  										Destination: "127.0.0.1-127.0.0.255",
   114  										Ports:       "8080,443",
   115  										Protocol:    "tcp",
   116  									},
   117  									{
   118  										Description: "Some running walking group too",
   119  										Destination: "127.20.20.20-127.20.20.25",
   120  										Ports:       "80,4443",
   121  										Protocol:    "udp",
   122  									},
   123  								},
   124  							},
   125  						},
   126  						ccv2.Warnings{"warning-11", "warning-12"},
   127  						nil)
   128  
   129  					fakeCloudControllerClient.GetSpaceStagingSecurityGroupsReturns(
   130  						[]ccv2.SecurityGroup{
   131  							{
   132  								Name: "some-staging-security-group",
   133  								Rules: []ccv2.SecurityGroupRule{
   134  									{
   135  										Description: "Some staging cinematic group",
   136  										Destination: "127.5.5.1-127.6.6.255",
   137  										Ports:       "32767,443",
   138  										Protocol:    "tcp",
   139  									},
   140  									{
   141  										Description: "Some staging cinematic group too",
   142  										Destination: "127.25.20.20-127.25.20.25",
   143  										Ports:       "80,9999",
   144  										Protocol:    "udp",
   145  									},
   146  								},
   147  							},
   148  							{
   149  								Name: "some-shared-security-group",
   150  								Rules: []ccv2.SecurityGroupRule{
   151  									{
   152  										Description: "Some shared cinematic group",
   153  										Destination: "0.0.0.0-5.6.7.8",
   154  										Ports:       "80,443",
   155  										Protocol:    "tcp",
   156  									},
   157  									{
   158  										Description: "Some shared cinematic group too",
   159  										Destination: "127.10.10.10-127.10.10.255",
   160  										Ports:       "80,4443",
   161  										Protocol:    "udp",
   162  									},
   163  								},
   164  							},
   165  						},
   166  						ccv2.Warnings{"warning-13", "warning-14"},
   167  						nil)
   168  				})
   169  
   170  				It("returns the space summary and all warnings", func() {
   171  					Expect(err).NotTo(HaveOccurred())
   172  
   173  					Expect(warnings).To(ConsistOf([]string{
   174  						"warning-1",
   175  						"warning-2",
   176  						"warning-3",
   177  						"warning-4",
   178  						"warning-5",
   179  						"warning-6",
   180  						"warning-7",
   181  						"warning-8",
   182  						"warning-9",
   183  						"warning-10",
   184  						"warning-11",
   185  						"warning-12",
   186  						"warning-13",
   187  						"warning-14",
   188  					}))
   189  
   190  					Expect(spaceSummary).To(Equal(SpaceSummary{
   191  						Space: Space{
   192  							Name:                     "some-space",
   193  							GUID:                     "some-space-guid",
   194  							SpaceQuotaDefinitionGUID: "some-space-quota-guid",
   195  						},
   196  						OrgName:                   "some-org",
   197  						AppNames:                  []string{"some-app-1", "some-app-2"},
   198  						ServiceInstanceNames:      []string{"some-service-instance-1", "some-service-instance-2"},
   199  						SpaceQuotaName:            "some-space-quota",
   200  						RunningSecurityGroupNames: []string{"some-running-security-group", "some-shared-security-group"},
   201  						StagingSecurityGroupNames: []string{"some-shared-security-group", "some-staging-security-group"},
   202  						SecurityGroupRules: []SecurityGroupRule{
   203  							{
   204  								Name:        "some-running-security-group",
   205  								Description: "Some running walking group",
   206  								Destination: "127.0.0.1-127.0.0.255",
   207  								Lifecycle:   "running",
   208  								Ports:       "8080,443",
   209  								Protocol:    "tcp",
   210  							},
   211  							{
   212  								Name:        "some-running-security-group",
   213  								Description: "Some running walking group too",
   214  								Destination: "127.20.20.20-127.20.20.25",
   215  								Lifecycle:   "running",
   216  								Ports:       "80,4443",
   217  								Protocol:    "udp",
   218  							},
   219  							{
   220  								Name:        "some-shared-security-group",
   221  								Description: "Some shared walking group",
   222  								Destination: "0.0.0.0-5.6.7.8",
   223  								Lifecycle:   "running",
   224  								Ports:       "80,443",
   225  								Protocol:    "tcp",
   226  							},
   227  							{
   228  								Name:        "some-shared-security-group",
   229  								Description: "Some shared cinematic group",
   230  								Destination: "0.0.0.0-5.6.7.8",
   231  								Lifecycle:   "staging",
   232  								Ports:       "80,443",
   233  								Protocol:    "tcp",
   234  							},
   235  							{
   236  								Name:        "some-shared-security-group",
   237  								Description: "Some shared walking group too",
   238  								Destination: "127.10.10.10-127.10.10.255",
   239  								Lifecycle:   "running",
   240  								Ports:       "80,4443",
   241  								Protocol:    "udp",
   242  							},
   243  							{
   244  								Name:        "some-shared-security-group",
   245  								Description: "Some shared cinematic group too",
   246  								Destination: "127.10.10.10-127.10.10.255",
   247  								Lifecycle:   "staging",
   248  								Ports:       "80,4443",
   249  								Protocol:    "udp",
   250  							},
   251  							{
   252  								Name:        "some-staging-security-group",
   253  								Description: "Some staging cinematic group too",
   254  								Destination: "127.25.20.20-127.25.20.25",
   255  								Lifecycle:   "staging",
   256  								Ports:       "80,9999",
   257  								Protocol:    "udp",
   258  							},
   259  							{
   260  								Name:        "some-staging-security-group",
   261  								Description: "Some staging cinematic group",
   262  								Destination: "127.5.5.1-127.6.6.255",
   263  								Lifecycle:   "staging",
   264  								Ports:       "32767,443",
   265  								Protocol:    "tcp",
   266  							},
   267  						},
   268  					}))
   269  
   270  					Expect(fakeCloudControllerClient.GetOrganizationCallCount()).To(Equal(1))
   271  					Expect(fakeCloudControllerClient.GetOrganizationArgsForCall(0)).To(Equal("some-org-guid"))
   272  
   273  					Expect(fakeCloudControllerClient.GetSpacesCallCount()).To(Equal(1))
   274  					filters := fakeCloudControllerClient.GetSpacesArgsForCall(0)
   275  					Expect(filters).To(ConsistOf(
   276  						ccv2.Filter{
   277  							Type:     constant.NameFilter,
   278  							Operator: constant.EqualOperator,
   279  							Values:   []string{"some-space"},
   280  						},
   281  						ccv2.Filter{
   282  							Type:     constant.OrganizationGUIDFilter,
   283  							Operator: constant.EqualOperator,
   284  							Values:   []string{"some-org-guid"},
   285  						},
   286  					))
   287  
   288  					Expect(fakeCloudControllerClient.GetApplicationsCallCount()).To(Equal(1))
   289  					filters = fakeCloudControllerClient.GetApplicationsArgsForCall(0)
   290  					Expect(filters).To(ConsistOf(
   291  						ccv2.Filter{
   292  							Type:     constant.SpaceGUIDFilter,
   293  							Operator: constant.EqualOperator,
   294  							Values:   []string{"some-space-guid"},
   295  						},
   296  					))
   297  
   298  					Expect(fakeCloudControllerClient.GetSpaceServiceInstancesCallCount()).To(Equal(1))
   299  					spaceGUID, includeUserProvidedServices, filters := fakeCloudControllerClient.GetSpaceServiceInstancesArgsForCall(0)
   300  					Expect(spaceGUID).To(Equal("some-space-guid"))
   301  					Expect(includeUserProvidedServices).To(BeTrue())
   302  					Expect(filters).To(BeNil())
   303  
   304  					Expect(fakeCloudControllerClient.GetSpaceQuotaDefinitionCallCount()).To(Equal(1))
   305  					spaceQuotaGUID := fakeCloudControllerClient.GetSpaceQuotaDefinitionArgsForCall(0)
   306  					Expect(spaceQuotaGUID).To(Equal("some-space-quota-guid"))
   307  
   308  					Expect(fakeCloudControllerClient.GetSpaceSecurityGroupsCallCount()).To(Equal(1))
   309  					spaceGUIDRunning, queriesRunning := fakeCloudControllerClient.GetSpaceSecurityGroupsArgsForCall(0)
   310  					Expect(spaceGUIDRunning).To(Equal("some-space-guid"))
   311  					Expect(queriesRunning).To(BeNil())
   312  
   313  					Expect(fakeCloudControllerClient.GetSpaceStagingSecurityGroupsCallCount()).To(Equal(1))
   314  					spaceGUIDStaging, queriesStaging := fakeCloudControllerClient.GetSpaceStagingSecurityGroupsArgsForCall(0)
   315  					Expect(spaceGUIDStaging).To(Equal("some-space-guid"))
   316  					Expect(queriesStaging).To(BeNil())
   317  				})
   318  
   319  				When("no space quota is assigned", func() {
   320  					BeforeEach(func() {
   321  						fakeCloudControllerClient.GetSpacesReturns(
   322  							[]ccv2.Space{
   323  								{
   324  									GUID: "some-space-guid",
   325  									Name: "some-space",
   326  								},
   327  							},
   328  							ccv2.Warnings{"warning-3", "warning-4"},
   329  							nil)
   330  					})
   331  
   332  					It("does not request space quota information or return a space quota name", func() {
   333  						Expect(fakeCloudControllerClient.GetSpaceQuotaDefinitionCallCount()).To(Equal(0))
   334  						Expect(spaceSummary.SpaceQuotaName).To(Equal(""))
   335  					})
   336  				})
   337  			})
   338  
   339  			When("an error is encountered getting the organization", func() {
   340  				var expectedErr error
   341  
   342  				BeforeEach(func() {
   343  					expectedErr = errors.New("get-org-error")
   344  					fakeCloudControllerClient.GetOrganizationReturns(
   345  						ccv2.Organization{},
   346  						ccv2.Warnings{
   347  							"warning-1",
   348  							"warning-2",
   349  						},
   350  						expectedErr)
   351  				})
   352  
   353  				It("returns the error and all warnings", func() {
   354  					Expect(err).To(MatchError(expectedErr))
   355  					Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
   356  				})
   357  			})
   358  
   359  			When("an error is encountered getting the space", func() {
   360  				var expectedErr error
   361  
   362  				BeforeEach(func() {
   363  					expectedErr = errors.New("get-space-error")
   364  
   365  					fakeCloudControllerClient.GetOrganizationReturns(
   366  						ccv2.Organization{
   367  							GUID: "some-org-guid",
   368  							Name: "some-org",
   369  						},
   370  						nil,
   371  						nil)
   372  
   373  					fakeCloudControllerClient.GetSpacesReturns(
   374  						[]ccv2.Space{},
   375  						ccv2.Warnings{"warning-1", "warning-2"},
   376  						expectedErr)
   377  				})
   378  
   379  				It("returns the error and all warnings", func() {
   380  					Expect(err).To(MatchError(expectedErr))
   381  					Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
   382  				})
   383  			})
   384  
   385  			When("an error is encountered getting the application", func() {
   386  				var expectedErr error
   387  
   388  				BeforeEach(func() {
   389  					expectedErr = errors.New("get-applications-error")
   390  
   391  					fakeCloudControllerClient.GetOrganizationReturns(
   392  						ccv2.Organization{
   393  							GUID: "some-org-guid",
   394  							Name: "some-org",
   395  						},
   396  						nil,
   397  						nil)
   398  
   399  					fakeCloudControllerClient.GetSpacesReturns(
   400  						[]ccv2.Space{
   401  							{
   402  								GUID:                     "some-space-guid",
   403  								Name:                     "some-space",
   404  								SpaceQuotaDefinitionGUID: "some-space-quota-guid",
   405  							},
   406  						},
   407  						nil,
   408  						nil)
   409  
   410  					fakeCloudControllerClient.GetApplicationsReturns(
   411  						[]ccv2.Application{},
   412  						ccv2.Warnings{"warning-1", "warning-2"},
   413  						expectedErr)
   414  				})
   415  
   416  				It("returns the error and all warnings", func() {
   417  					Expect(err).To(MatchError(expectedErr))
   418  					Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
   419  				})
   420  			})
   421  
   422  			When("an error is encountered getting the service instances", func() {
   423  				var expectedErr error
   424  
   425  				BeforeEach(func() {
   426  					expectedErr = errors.New("get-service-instances-error")
   427  
   428  					fakeCloudControllerClient.GetOrganizationReturns(
   429  						ccv2.Organization{
   430  							GUID: "some-org-guid",
   431  							Name: "some-org",
   432  						},
   433  						nil,
   434  						nil)
   435  
   436  					fakeCloudControllerClient.GetSpacesReturns(
   437  						[]ccv2.Space{
   438  							{
   439  								GUID:                     "some-space-guid",
   440  								Name:                     "some-space",
   441  								SpaceQuotaDefinitionGUID: "some-space-quota-guid",
   442  							},
   443  						},
   444  						nil,
   445  						nil)
   446  
   447  					fakeCloudControllerClient.GetApplicationsReturns(
   448  						[]ccv2.Application{
   449  							{
   450  								Name: "some-app-2",
   451  							},
   452  							{
   453  								Name: "some-app-1",
   454  							},
   455  						},
   456  						nil,
   457  						nil)
   458  
   459  					fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   460  						[]ccv2.ServiceInstance{},
   461  						ccv2.Warnings{"warning-1", "warning-2"},
   462  						expectedErr)
   463  				})
   464  
   465  				It("returns the error and all warnings", func() {
   466  					Expect(err).To(MatchError(expectedErr))
   467  					Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
   468  				})
   469  			})
   470  
   471  			When("an error is encountered getting the space quota", func() {
   472  				var expectedErr error
   473  
   474  				BeforeEach(func() {
   475  					expectedErr = errors.New("get-space-quota-error")
   476  
   477  					fakeCloudControllerClient.GetOrganizationReturns(
   478  						ccv2.Organization{
   479  							GUID: "some-org-guid",
   480  							Name: "some-org",
   481  						},
   482  						nil,
   483  						nil)
   484  
   485  					fakeCloudControllerClient.GetSpacesReturns(
   486  						[]ccv2.Space{
   487  							{
   488  								GUID:                     "some-space-guid",
   489  								Name:                     "some-space",
   490  								SpaceQuotaDefinitionGUID: "some-space-quota-guid",
   491  							},
   492  						},
   493  						nil,
   494  						nil)
   495  
   496  					fakeCloudControllerClient.GetApplicationsReturns(
   497  						[]ccv2.Application{
   498  							{
   499  								Name: "some-app-2",
   500  							},
   501  							{
   502  								Name: "some-app-1",
   503  							},
   504  						},
   505  						nil,
   506  						nil)
   507  
   508  					fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   509  						[]ccv2.ServiceInstance{
   510  							{
   511  								GUID: "some-service-instance-guid-2",
   512  								Name: "some-service-instance-2",
   513  							},
   514  							{
   515  								GUID: "some-service-instance-guid-1",
   516  								Name: "some-service-instance-1",
   517  							},
   518  						},
   519  						nil,
   520  						nil)
   521  
   522  					fakeCloudControllerClient.GetSpaceQuotaDefinitionReturns(
   523  						ccv2.SpaceQuota{},
   524  						ccv2.Warnings{"warning-1", "warning-2"},
   525  						expectedErr)
   526  				})
   527  
   528  				It("returns the error and all warnings", func() {
   529  					Expect(err).To(MatchError(expectedErr))
   530  					Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
   531  				})
   532  			})
   533  
   534  			When("an error is encountered getting the running security groups", func() {
   535  				var expectedErr error
   536  
   537  				BeforeEach(func() {
   538  					expectedErr = errors.New("get-running-security-groups-error")
   539  
   540  					fakeCloudControllerClient.GetOrganizationReturns(
   541  						ccv2.Organization{
   542  							GUID: "some-org-guid",
   543  							Name: "some-org",
   544  						},
   545  						nil,
   546  						nil)
   547  
   548  					fakeCloudControllerClient.GetSpacesReturns(
   549  						[]ccv2.Space{
   550  							{
   551  								GUID:                     "some-space-guid",
   552  								Name:                     "some-space",
   553  								SpaceQuotaDefinitionGUID: "some-space-quota-guid",
   554  							},
   555  						},
   556  						nil,
   557  						nil)
   558  
   559  					fakeCloudControllerClient.GetApplicationsReturns(
   560  						[]ccv2.Application{
   561  							{
   562  								Name: "some-app-2",
   563  							},
   564  							{
   565  								Name: "some-app-1",
   566  							},
   567  						},
   568  						nil,
   569  						nil)
   570  
   571  					fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   572  						[]ccv2.ServiceInstance{
   573  							{
   574  								GUID: "some-service-instance-guid-2",
   575  								Name: "some-service-instance-2",
   576  							},
   577  							{
   578  								GUID: "some-service-instance-guid-1",
   579  								Name: "some-service-instance-1",
   580  							},
   581  						},
   582  						nil,
   583  						nil)
   584  
   585  					fakeCloudControllerClient.GetSpaceQuotaDefinitionReturns(
   586  						ccv2.SpaceQuota{
   587  							GUID: "some-space-quota-guid",
   588  							Name: "some-space-quota",
   589  						},
   590  						nil,
   591  						nil)
   592  
   593  					fakeCloudControllerClient.GetSpaceSecurityGroupsReturns(
   594  						[]ccv2.SecurityGroup{},
   595  						ccv2.Warnings{"warning-1", "warning-2"},
   596  						expectedErr)
   597  				})
   598  
   599  				It("returns the error and all warnings", func() {
   600  					Expect(err).To(MatchError(expectedErr))
   601  					Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
   602  				})
   603  			})
   604  
   605  			When("an error is encountered getting the staging security groups", func() {
   606  				var expectedErr error
   607  
   608  				BeforeEach(func() {
   609  					expectedErr = errors.New("get-staging-security-groups-error")
   610  
   611  					fakeCloudControllerClient.GetOrganizationReturns(
   612  						ccv2.Organization{
   613  							GUID: "some-org-guid",
   614  							Name: "some-org",
   615  						},
   616  						nil,
   617  						nil)
   618  
   619  					fakeCloudControllerClient.GetSpacesReturns(
   620  						[]ccv2.Space{
   621  							{
   622  								GUID:                     "some-space-guid",
   623  								Name:                     "some-space",
   624  								SpaceQuotaDefinitionGUID: "some-space-quota-guid",
   625  							},
   626  						},
   627  						nil,
   628  						nil)
   629  
   630  					fakeCloudControllerClient.GetApplicationsReturns(
   631  						[]ccv2.Application{
   632  							{
   633  								Name: "some-app-2",
   634  							},
   635  							{
   636  								Name: "some-app-1",
   637  							},
   638  						},
   639  						nil,
   640  						nil)
   641  
   642  					fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   643  						[]ccv2.ServiceInstance{
   644  							{
   645  								GUID: "some-service-instance-guid-2",
   646  								Name: "some-service-instance-2",
   647  							},
   648  							{
   649  								GUID: "some-service-instance-guid-1",
   650  								Name: "some-service-instance-1",
   651  							},
   652  						},
   653  						nil,
   654  						nil)
   655  
   656  					fakeCloudControllerClient.GetSpaceQuotaDefinitionReturns(
   657  						ccv2.SpaceQuota{
   658  							GUID: "some-space-quota-guid",
   659  							Name: "some-space-quota",
   660  						},
   661  						nil,
   662  						nil)
   663  
   664  					fakeCloudControllerClient.GetSpaceSecurityGroupsReturns(
   665  						[]ccv2.SecurityGroup{},
   666  						nil,
   667  						nil)
   668  
   669  					fakeCloudControllerClient.GetSpaceStagingSecurityGroupsReturns(
   670  						[]ccv2.SecurityGroup{},
   671  						ccv2.Warnings{"warning-1", "warning-2"},
   672  						expectedErr)
   673  				})
   674  
   675  				It("returns the error and all warnings", func() {
   676  					Expect(err).To(MatchError(expectedErr))
   677  					Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
   678  				})
   679  			})
   680  		})
   681  	})
   682  })