CUSTESC-33731: Make rule match test report rule in 0-index base
This changes guarantees that the coommand to report rule matches when testing local config reports the rule number using the 0-based indexing. This is to be consistent with the 0-based indexing on the log lines when proxying requests.
This commit is contained in:
		
							parent
							
								
									541c63d737
								
							
						
					
					
						commit
						adb7d40084
					
				|  | @ -139,7 +139,7 @@ func testURLCommand(c *cli.Context) error { | |||
| 	} | ||||
| 
 | ||||
| 	_, i := ing.FindMatchingRule(requestURL.Hostname(), requestURL.Path) | ||||
| 	fmt.Printf("Matched rule #%d\n", i+1) | ||||
| 	fmt.Printf("Matched rule #%d\n", i) | ||||
| 	fmt.Println(ing.Rules[i].MultiLineString()) | ||||
| 	return nil | ||||
| } | ||||
|  |  | |||
|  | @ -36,17 +36,17 @@ class TestConfig: | |||
|         _ = start_cloudflared(tmp_path, config, validate_args) | ||||
| 
 | ||||
|         self.match_rule(tmp_path, config, | ||||
|                         "http://example.com/index.html", 1) | ||||
|                         "http://example.com/index.html", 0) | ||||
|         self.match_rule(tmp_path, config, | ||||
|                         "https://example.com/index.html", 1) | ||||
|                         "https://example.com/index.html", 0) | ||||
|         self.match_rule(tmp_path, config, | ||||
|                         "https://api.example.com/login", 2) | ||||
|                         "https://api.example.com/login", 1) | ||||
|         self.match_rule(tmp_path, config, | ||||
|                         "https://wss.example.com", 3) | ||||
|                         "https://wss.example.com", 2) | ||||
|         self.match_rule(tmp_path, config, | ||||
|                         "https://ssh.example.com", 4) | ||||
|                         "https://ssh.example.com", 3) | ||||
|         self.match_rule(tmp_path, config, | ||||
|                         "https://api.example.com", 5) | ||||
|                         "https://api.example.com", 4) | ||||
| 
 | ||||
|     # This is used to check that the command tunnel ingress url <url> matches rule number <rule_num>. Note that rule number uses 1-based indexing | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue