Skip to content

Commit 66053d0

Browse files
authored
Merge pull request #47 from nginxinc/ps-dev-split-clients
Update to handle split_clients
2 parents 1209646 + a598d5e commit 66053d0

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func main() {
7575

7676
## Contributing
7777

78-
If you'd like to contribute to the project, please read our [Contributing guide](docs/CONTRIBUTING.md).
78+
If you'd like to contribute to the project, please read our [Contributing guide](CONTRIBUTING.md).
7979

8080
## License
8181

analyze_map.go

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ var mapBodies = map[string]mapParameterMasks{
3535
"types": {
3636
defaultMasks: ngxConf1More,
3737
},
38+
"split_clients": {
39+
defaultMasks: ngxConfTake1,
40+
},
3841
}
3942

4043
// analyzeMapBody validates the body of a map-like directive. Map-like directives are block directives

analyze_map_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,27 @@ func TestAnalyzeMapBody(t *testing.T) {
144144
term: ";",
145145
wantErr: &ParseError{What: "invalid number of parameters"},
146146
},
147+
"valid split_clients": {
148+
mapDirective: "split_clients",
149+
parameter: &Directive{
150+
Directive: "0.5%",
151+
Args: []string{"google.com"},
152+
Line: 5,
153+
Block: Directives{},
154+
},
155+
term: ";",
156+
},
157+
"invalid split_clients": {
158+
mapDirective: "split_clients",
159+
parameter: &Directive{
160+
Directive: "0.5%",
161+
Args: []string{"google.com", "testme"},
162+
Line: 5,
163+
Block: Directives{},
164+
},
165+
term: ";",
166+
wantErr: &ParseError{What: "invalid number of parameters"},
167+
},
147168
"missing semicolon": {
148169
mapDirective: "map",
149170
parameter: &Directive{

0 commit comments

Comments
 (0)