diff --git a/pkg/registry/file/dynamicpathdetector/tests/analyze_endpoints_test.go b/pkg/registry/file/dynamicpathdetector/tests/analyze_endpoints_test.go index 9b9f6a42..852eb4c9 100644 --- a/pkg/registry/file/dynamicpathdetector/tests/analyze_endpoints_test.go +++ b/pkg/registry/file/dynamicpathdetector/tests/analyze_endpoints_test.go @@ -213,30 +213,3 @@ func TestAnalyzeEndpointsWithInvalidURL(t *testing.T) { result := dynamicpathdetector.AnalyzeEndpoints(&input, analyzer) assert.Equal(t, 0, len(result)) } - -func TestAnalyzeEndpointsBug(t *testing.T) { - analyzer := dynamicpathdetector.NewPathAnalyzer(100) - - endpoints := []types.HTTPEndpoint{ - types.HTTPEndpoint{Endpoint: ":8000/", Methods: []string{"GET"}, Internal: false, Direction: "inbound", Headers: json.RawMessage{0x7b, 0x22, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x5b, 0x22, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x22, 0x5d, 0x2c, 0x22, 0x48, 0x6f, 0x73, 0x74, 0x22, 0x3a, 0x5b, 0x22, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x3a, 0x38, 0x30, 0x30, 0x30, 0x22, 0x5d, 0x7d}}, - types.HTTPEndpoint{Endpoint: ":8000/", Methods: []string{"GET"}, Internal: false, Direction: "inbound", Headers: json.RawMessage{0x7b, 0x22, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x5b, 0x22, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x22, 0x5d, 0x2c, 0x22, 0x48, 0x6f, 0x73, 0x74, 0x22, 0x3a, 0x5b, 0x22, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x3a, 0x38, 0x30, 0x30, 0x30, 0x22, 0x5d, 0x7d}}, - - types.HTTPEndpoint{Endpoint: ":8000/", Methods: []string{"GET"}, Internal: false, Direction: "inbound", Headers: json.RawMessage{0x7b, 0x22, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x5b, 0x22, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x22, 0x5d, 0x2c, 0x22, 0x48, 0x6f, 0x73, 0x74, 0x22, 0x3a, 0x5b, 0x22, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x3a, 0x38, 0x30, 0x30, 0x30, 0x22, 0x5d, 0x7d}}, - } - - for i := 0; i < 120; i++ { - e := types.HTTPEndpoint{Endpoint: fmt.Sprintf(":8000/users/%d", i), Methods: []string{"GET"}, Internal: false, Direction: "inbound", Headers: json.RawMessage{0x7b, 0x22, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x5b, 0x22, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x22, 0x5d, 0x2c, 0x22, 0x48, 0x6f, 0x73, 0x74, 0x22, 0x3a, 0x5b, 0x22, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x3a, 0x38, 0x30, 0x30, 0x30, 0x22, 0x5d, 0x7d}} - endpoints = append(endpoints, e) - } - - fmt.Println(endpoints) - - result := dynamicpathdetector.AnalyzeEndpoints(&endpoints, analyzer) - - endpoints = result - c := types.HTTPEndpoint{Endpoint: ":8000/", Methods: []string{"POST"}, Internal: false, Direction: "inbound", Headers: json.RawMessage{0x7b, 0x22, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x5b, 0x22, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x22, 0x5d, 0x2c, 0x22, 0x48, 0x6f, 0x73, 0x74, 0x22, 0x3a, 0x5b, 0x22, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x3a, 0x38, 0x30, 0x30, 0x30, 0x22, 0x5d, 0x7d}} - endpoints = append(endpoints, c) - result = dynamicpathdetector.AnalyzeEndpoints(&endpoints, analyzer) - fmt.Println(result) - -}