Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestResourcePatternFilter_Matches in resource_pattern_filter_test.go is failing #11

Open
ackris opened this issue Sep 10, 2024 · 1 comment
Labels
bug Something isn't working unit test label to indicate unit tests

Comments

@ackris
Copy link
Owner

ackris commented Sep 10, 2024

While executing TestResourcePatternFilter_Matches method, two of its test cases is failing with the below error.


resource_pattern_filter_test.go:66: Expected filter to match the prefixed pattern: filter=ResourcePatternFilter{resourceType=TOPIC, name="payments.", patternType=PREFIXED}, pattern=ResourcePattern{resourceType=TOPIC, name="payments.received", patternType=LITERAL}

resource_pattern_filter_test.go:73: Expected filter to match the wildcard pattern: filter=ResourcePatternFilter{resourceType=TOPIC, name="*", patternType=LITERAL}, pattern=ResourcePattern{resourceType=TOPIC, name="payments.received", patternType=LITERAL}
@ackris ackris added the bug Something isn't working label Sep 10, 2024
@ackris
Copy link
Owner Author

ackris commented Sep 10, 2024

These are the methods to be specific

// Test matching with PREFIXED
	filter, _ = NewResourcePatternFilter(TOPIC, "payments.", PREFIXED)
	pattern, _ = NewResourcePattern(TOPIC, "payments.received", LITERAL)
	if !filter.Matches(pattern) {
		t.Errorf("Expected filter to match the prefixed pattern: filter=%s, pattern=%s", filter, pattern)
	}

	// Test wildcard matching
	filter, _ = NewResourcePatternFilter(TOPIC, "*", LITERAL)
	pattern, _ = NewResourcePattern(TOPIC, "payments.received", LITERAL)
	if !filter.Matches(pattern) {
		t.Errorf("Expected filter to match the wildcard pattern: filter=%s, pattern=%s", filter, pattern)
	}

@ackris ackris added the unit test label to indicate unit tests label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unit test label to indicate unit tests
Projects
None yet
Development

No branches or pull requests

1 participant