Skip to content

Commit

Permalink
[typo] Pluin -> Plugin (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderflow authored Sep 29, 2024
1 parent 5d9d641 commit b903112
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 67 deletions.
8 changes: 4 additions & 4 deletions api/plugins/tests/integration/controlplane/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (cp *ControlPlane) UseGoPluginConfig(t *testing.T, config *filtermanager.Fi
"fm": {
Override: &golang.RouterPlugin_Config{
Config: proto.MessageToAny(
FilterManagerConfigToTypedStruct(NewPluinConfig(nil))),
FilterManagerConfigToTypedStruct(NewPluginConfig(nil))),
},
},
},
Expand All @@ -208,7 +208,7 @@ func (cp *ControlPlane) UseGoPluginConfig(t *testing.T, config *filtermanager.Fi
"fm": {
Override: &golang.RouterPlugin_Config{
Config: proto.MessageToAny(
FilterManagerConfigToTypedStruct(NewSinglePluinConfig("coverage", nil))),
FilterManagerConfigToTypedStruct(NewSinglePluginConfig("coverage", nil))),
},
},
},
Expand Down Expand Up @@ -243,14 +243,14 @@ func FilterManagerConfigToTypedStruct(fmc *filtermanager.FilterManagerConfig) *x
}
}

func NewSinglePluinConfig(name string, config interface{}) *filtermanager.FilterManagerConfig {
func NewSinglePluginConfig(name string, config interface{}) *filtermanager.FilterManagerConfig {
fmc := &filtermanager.FilterManagerConfig{}
fmc.Namespace = "ns"
fmc.Plugins = []*model.FilterConfig{{Name: name, Config: config}}
return fmc
}

func NewPluinConfig(plugins []*model.FilterConfig) *filtermanager.FilterManagerConfig {
func NewPluginConfig(plugins []*model.FilterConfig) *filtermanager.FilterManagerConfig {
fmc := &filtermanager.FilterManagerConfig{}
fmc.Namespace = "ns"
fmc.Plugins = plugins
Expand Down
2 changes: 1 addition & 1 deletion api/tests/integration/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestLogLevelCache(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewSinglePluinConfig("buffer", map[string]interface{}{})
config := controlplane.NewSinglePluginConfig("buffer", map[string]interface{}{})
controlPlane.UseGoPluginConfig(t, config, dp)
err = dp.SetLogLevel("golang", "debug")
require.Nil(t, err)
Expand Down
4 changes: 2 additions & 2 deletions api/tests/integration/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestBenchmarkPlugin(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewSinglePluinConfig("benchmark", map[string]interface{}{})
config := controlplane.NewSinglePluginConfig("benchmark", map[string]interface{}{})
controlPlane.UseGoPluginConfig(t, config, dp)

runBenchmark(t, clientBin, "http://localhost:10000/echo")
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestBenchmarkPluginFromConsumer(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewPluinConfig([]*model.FilterConfig{
config := controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "consumer",
Config: map[string]interface{}{},
Expand Down
8 changes: 4 additions & 4 deletions api/tests/integration/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestConsumerWithFilter(t *testing.T) {
}{
{
name: "authn & exec",
config: controlplane.NewSinglePluinConfig("consumer", map[string]interface{}{}),
config: controlplane.NewSinglePluginConfig("consumer", map[string]interface{}{}),
run: func(t *testing.T) {
resp, _ := dp.Get("/echo", http.Header{"Authorization": []string{"marvin"}})
assert.Equal(t, 206, resp.StatusCode)
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestConsumerWithFilterInitFailed(t *testing.T) {
}{
{
name: "authn & exec",
config: controlplane.NewSinglePluinConfig("consumer", map[string]interface{}{}),
config: controlplane.NewSinglePluginConfig("consumer", map[string]interface{}{}),
run: func(t *testing.T) {
resp, _ := dp.Get("/echo", http.Header{"Authorization": []string{"marvin"}})
assert.Equal(t, 500, resp.StatusCode)
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestConsumerWithFilterAndMergeFromFilter(t *testing.T) {
}{
{
name: "authn & exec",
config: controlplane.NewSinglePluinConfig("consumer", map[string]interface{}{}),
config: controlplane.NewSinglePluginConfig("consumer", map[string]interface{}{}),
run: func(t *testing.T) {
resp, _ := dp.Get("/echo", http.Header{"Authorization": []string{"marvin"}})
assert.Equal(t, 206, resp.StatusCode)
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestConsumerFilterNotAfterConsumerRunInLaterPhase(t *testing.T) {
}{
{
name: "authn & exec",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "beforeConsumerAndHasOtherMethod",
Config: map[string]interface{}{},
Expand Down
6 changes: 3 additions & 3 deletions api/tests/integration/filtermanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ func TestFilterManagerIgnoreUnknownFields(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewSinglePluinConfig("buffer", map[string]interface{}{
config := controlplane.NewSinglePluginConfig("buffer", map[string]interface{}{
"unknown": "blah",
})
controlPlane.UseGoPluginConfig(t, config, dp)
Expand All @@ -927,7 +927,7 @@ func TestFilterManagerPluginReturnsErrorInParse(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewSinglePluinConfig("buffer", map[string]interface{}{
config := controlplane.NewSinglePluginConfig("buffer", map[string]interface{}{
"decode": []string{"wrong type"},
})
controlPlane.UseGoPluginConfig(t, config, dp)
Expand Down Expand Up @@ -1093,7 +1093,7 @@ func TestFilterManagerRecordLocalReplyPlugin(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewSinglePluinConfig("localReply", map[string]interface{}{
config := controlplane.NewSinglePluginConfig("localReply", map[string]interface{}{
"decode": true,
"headers": true,
})
Expand Down
6 changes: 3 additions & 3 deletions api/tests/integration/http_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func TestFilterMergeIntoRoute(t *testing.T) {
},
{
name: "init should be called only once (route version)",
config: controlplane.NewSinglePluinConfig("init", map[string]interface{}{}),
config: controlplane.NewSinglePluginConfig("init", map[string]interface{}{}),
run: func(t *testing.T) {
resp, _ := dp.Get("/echo", nil)
assert.Equal(t, 200, resp.StatusCode)
Expand All @@ -131,7 +131,7 @@ func TestFilterMergeIntoRoute(t *testing.T) {
},
{
name: "override",
config: controlplane.NewSinglePluinConfig("buffer", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("buffer", map[string]interface{}{
"decode": true,
"need": true,
}),
Expand All @@ -143,7 +143,7 @@ func TestFilterMergeIntoRoute(t *testing.T) {
},
{
name: "sort merged plugins",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "stream",
Config: map[string]interface{}{},
Expand Down
4 changes: 2 additions & 2 deletions plugins/tests/integration/casbin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ g, bob, admin
}{
{
name: "happy path",
config: controlplane.NewSinglePluinConfig("casbin", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("casbin", map[string]interface{}{
"rule": map[string]string{
"model": modelFile.Name(),
"policy": policyFile.Name(),
Expand All @@ -89,7 +89,7 @@ g, bob, admin
},
{
name: "change config",
config: controlplane.NewSinglePluinConfig("casbin", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("casbin", map[string]interface{}{
"rule": map[string]string{
"model": modelFile.Name(),
"policy": policyFile2.Name(),
Expand Down
4 changes: 2 additions & 2 deletions plugins/tests/integration/cel_script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestCelScript(t *testing.T) {
}{
{
name: "allowIf",
config: controlplane.NewSinglePluinConfig("celScript", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("celScript", map[string]interface{}{
"allowIf": `request.path() == "/echo" && request.method() == "GET"`,
}),
expect: func(t *testing.T, resp *http.Response) {
Expand All @@ -49,7 +49,7 @@ func TestCelScript(t *testing.T) {
},
{
name: "allowIf, reject",
config: controlplane.NewSinglePluinConfig("celScript", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("celScript", map[string]interface{}{
"allowIf": `request.path() == "/echo" && request.method() != "GET"`,
}),
expect: func(t *testing.T, resp *http.Response) {
Expand Down
8 changes: 4 additions & 4 deletions plugins/tests/integration/consumer_restriction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestConsumerRestriction(t *testing.T) {
}{
{
name: "allow",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "keyAuth",
Config: map[string]interface{}{
Expand Down Expand Up @@ -92,7 +92,7 @@ func TestConsumerRestriction(t *testing.T) {
},
{
name: "allowed by method",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "keyAuth",
Config: map[string]interface{}{
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestConsumerRestriction(t *testing.T) {
},
{
name: "deny",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "keyAuth",
Config: map[string]interface{}{
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestConsumerRestriction(t *testing.T) {
},
{
name: "denied by method",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "keyAuth",
Config: map[string]interface{}{
Expand Down
10 changes: 5 additions & 5 deletions plugins/tests/integration/debug_mode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestDebugModeSlowLog(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewPluinConfig([]*model.FilterConfig{
config := controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "debugMode",
Config: map[string]interface{}{
Expand Down Expand Up @@ -87,7 +87,7 @@ func TestDebugModeSlowLogNoPlugin(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewPluinConfig([]*model.FilterConfig{
config := controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "debugMode",
Config: map[string]interface{}{
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestDebugModeSlowLogNoEncodeHeaders(t *testing.T) {
}
defer dp.Stop()

config := controlplane.NewPluinConfig([]*model.FilterConfig{
config := controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "debugMode",
Config: map[string]interface{}{
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestDebugModeSlowLogNotEmit(t *testing.T) {
}{
{
name: "not emit",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "debugMode",
Config: map[string]interface{}{
Expand Down Expand Up @@ -212,7 +212,7 @@ func TestDebugModeSlowLogWithFiltersFromConsumer(t *testing.T) {
}{
{
name: "sanity",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "debugMode",
Config: map[string]interface{}{
Expand Down
4 changes: 2 additions & 2 deletions plugins/tests/integration/demo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestDemo(t *testing.T) {
}{
{
name: "happy path",
config: controlplane.NewSinglePluinConfig("demo", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("demo", map[string]interface{}{
"hostName": "Tom",
}),
expect: func(t *testing.T, resp *http.Response) {
Expand All @@ -51,7 +51,7 @@ func TestDemo(t *testing.T) {
},
{
name: "change config",
config: controlplane.NewSinglePluinConfig("demo", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("demo", map[string]interface{}{
"hostName": "Mike",
}),

Expand Down
8 changes: 4 additions & 4 deletions plugins/tests/integration/ext_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestExtAuth(t *testing.T) {
}{
{
name: "default",
config: controlplane.NewSinglePluinConfig("extAuth", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("extAuth", map[string]interface{}{
"httpService": map[string]interface{}{
"url": "http://127.0.0.1:10001/ext_auth",
},
Expand All @@ -68,7 +68,7 @@ func TestExtAuth(t *testing.T) {
},
{
name: "failed to ext auth",
config: controlplane.NewSinglePluinConfig("extAuth", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("extAuth", map[string]interface{}{
"httpService": map[string]interface{}{
"url": "http://127.0.0.1:2023/ext_auth",
"statusOnError": 401,
Expand All @@ -81,7 +81,7 @@ func TestExtAuth(t *testing.T) {
},
{
name: "allow failure mode",
config: controlplane.NewSinglePluinConfig("extAuth", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("extAuth", map[string]interface{}{
"httpService": map[string]interface{}{
"url": "http://127.0.0.1:2023/ext_auth",
"statusOnError": 403,
Expand All @@ -95,7 +95,7 @@ func TestExtAuth(t *testing.T) {
},
{
name: "with body",
config: controlplane.NewSinglePluinConfig("extAuth", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("extAuth", map[string]interface{}{
"httpService": map[string]interface{}{
"url": "http://127.0.0.1:10001/ext_auth",
"withRequestBody": true,
Expand Down
4 changes: 2 additions & 2 deletions plugins/tests/integration/hmac_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestHmacAuth(t *testing.T) {
}{
{
name: "sanity",
config: controlplane.NewSinglePluinConfig("hmacAuth", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("hmacAuth", map[string]interface{}{
"signatureHeader": "x-sign-hdr",
"accessKeyHeader": "x-ak",
"dateHeader": "x-date",
Expand All @@ -76,7 +76,7 @@ func TestHmacAuth(t *testing.T) {
},
{
name: "bypass if no credential",
config: controlplane.NewPluinConfig([]*model.FilterConfig{
config: controlplane.NewPluginConfig([]*model.FilterConfig{
{
Name: "hmacAuth",
Config: map[string]interface{}{
Expand Down
4 changes: 2 additions & 2 deletions plugins/tests/integration/key_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestKeyAuth(t *testing.T) {
}{
{
name: "key in the header",
config: controlplane.NewSinglePluinConfig("keyAuth", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("keyAuth", map[string]interface{}{
"keys": []interface{}{
map[string]interface{}{
"name": "Authorization",
Expand All @@ -72,7 +72,7 @@ func TestKeyAuth(t *testing.T) {
},
{
name: "key in the query",
config: controlplane.NewSinglePluinConfig("keyAuth", map[string]interface{}{
config: controlplane.NewSinglePluginConfig("keyAuth", map[string]interface{}{
"keys": []interface{}{
map[string]interface{}{
"name": "Authorization",
Expand Down
Loading

0 comments on commit b903112

Please sign in to comment.