Skip to content

Commit

Permalink
Add e2e test for IPBlocksInfo (#983) (#999)
Browse files Browse the repository at this point in the history
Signed-off-by: Yanjun Zhou <[email protected]>
  • Loading branch information
yanjunz97 authored Jan 14, 2025
1 parent f2caf19 commit a4c4291
Show file tree
Hide file tree
Showing 11 changed files with 200 additions and 86 deletions.
1 change: 1 addition & 0 deletions pkg/apis/vpc/v1alpha1/ipblocksinfo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

// +genclient
// +genclient:nonNamespaced
//+kubebuilder:object:root=true
//+kubebuilder:resource:scope="Cluster",path=ipblocksinfos

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions pkg/client/clientset/versioned/typed/vpc/v1alpha1/ipblocksinfo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions pkg/client/listers/vpc/v1alpha1/expansion_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 6 additions & 37 deletions pkg/client/listers/vpc/v1alpha1/ipblocksinfo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,15 +643,12 @@ func deleteYAML(filename string, ns string) error {
// tags should be present in pairs, the first tag is the scope, the second tag is the value
// caller should transform the response to the expected resource type
func (data *TestData) queryResource(resourceType string, tags []string) (model.SearchResponse, error) {
tagScopeClusterKey := strings.Replace(common.TagScopeNamespace, "/", "\\/", -1)
tagScopeClusterValue := strings.Replace(tags[0], ":", "\\:", -1)
tagParam := fmt.Sprintf("tags.scope:%s AND tags.tag:%s", tagScopeClusterKey, tagScopeClusterValue)
resourceParam := fmt.Sprintf("%s:%s", common.ResourceType, resourceType)
queryParam := resourceParam + " AND " + tagParam
queryParam := resourceParam
if len(tags) >= 2 {
tagscope := strings.Replace(tags[0], "/", "\\/", -1)
tagtag := strings.Replace(tags[1], ":", "\\:", -1)
tagParam = fmt.Sprintf("tags.scope:%s AND tags.tag:%s", tagscope, tagtag)
tagParam := fmt.Sprintf("tags.scope:%s AND tags.tag:%s", tagscope, tagtag)
queryParam = resourceParam + " AND " + tagParam
}
queryParam += " AND marked_for_delete:false"
Expand Down
Loading

0 comments on commit a4c4291

Please sign in to comment.