Skip to content

Commit

Permalink
chore: rename translator util pkg to translate
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneutt committed Dec 1, 2022
1 parent 7a4f57f commit a1e5a46
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package translator
package translate

import (
gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package translator
package translate

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package translator
package translate

import (
gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package translator
package translate

import (
"testing"
Expand Down
58 changes: 29 additions & 29 deletions apis/v1alpha2/validation/httproute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
utilpointer "k8s.io/utils/pointer"

gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
"sigs.k8s.io/gateway-api/apis/v1alpha2/util/translator"
"sigs.k8s.io/gateway-api/apis/v1beta1/util/translate"
)

func TestValidateHTTPRoute(t *testing.T) {
Expand All @@ -45,7 +45,7 @@ func TestValidateHTTPRoute(t *testing.T) {
Matches: []gatewayv1a2.HTTPRouteMatch{
{
Path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("PathPrefix"),
Type: translate.PathMatchTypePtr("PathPrefix"),
Value: utilpointer.String("/"),
},
},
Expand All @@ -55,7 +55,7 @@ func TestValidateHTTPRoute(t *testing.T) {
BackendRef: gatewayv1a2.BackendRef{
BackendObjectReference: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
Weight: utilpointer.Int32(100),
},
Expand All @@ -71,7 +71,7 @@ func TestValidateHTTPRoute(t *testing.T) {
Matches: []gatewayv1a2.HTTPRouteMatch{
{
Path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("PathPrefix"),
Type: translate.PathMatchTypePtr("PathPrefix"),
Value: utilpointer.String("/"),
},
},
Expand All @@ -82,7 +82,7 @@ func TestValidateHTTPRoute(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8081),
Port: translate.PortNumberPtr(8081),
},
},
},
Expand All @@ -97,7 +97,7 @@ func TestValidateHTTPRoute(t *testing.T) {
Matches: []gatewayv1a2.HTTPRouteMatch{
{
Path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("PathPrefix"),
Type: translate.PathMatchTypePtr("PathPrefix"),
Value: utilpointer.String("/"),
},
},
Expand All @@ -108,7 +108,7 @@ func TestValidateHTTPRoute(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand All @@ -117,7 +117,7 @@ func TestValidateHTTPRoute(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: specialService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand All @@ -132,7 +132,7 @@ func TestValidateHTTPRoute(t *testing.T) {
Matches: []gatewayv1a2.HTTPRouteMatch{
{
Path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("PathPrefix"),
Type: translate.PathMatchTypePtr("PathPrefix"),
Value: utilpointer.String("/"),
},
},
Expand All @@ -154,7 +154,7 @@ func TestValidateHTTPRoute(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand All @@ -180,7 +180,7 @@ func TestValidateHTTPRoute(t *testing.T) {
Matches: []gatewayv1a2.HTTPRouteMatch{
{
Path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("PathPrefix"),
Type: translate.PathMatchTypePtr("PathPrefix"),
Value: utilpointer.String("/"),
},
},
Expand All @@ -191,7 +191,7 @@ func TestValidateHTTPRoute(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand All @@ -211,7 +211,7 @@ func TestValidateHTTPRoute(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand All @@ -231,7 +231,7 @@ func TestValidateHTTPRoute(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: specialService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand All @@ -246,7 +246,7 @@ func TestValidateHTTPRoute(t *testing.T) {
Matches: []gatewayv1a2.HTTPRouteMatch{
{
Path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("PathPrefix"),
Type: translate.PathMatchTypePtr("PathPrefix"),
Value: utilpointer.String("/"),
},
},
Expand All @@ -268,7 +268,7 @@ func TestValidateHTTPRoute(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand Down Expand Up @@ -453,7 +453,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) {
BackendRef: gatewayv1a2.BackendRef{
BackendObjectReference: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
Weight: utilpointer.Int32(100),
},
Expand All @@ -463,7 +463,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand All @@ -480,7 +480,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) {
BackendRef: gatewayv1a2.BackendRef{
BackendObjectReference: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
Filters: []gatewayv1a2.HTTPRouteFilter{
Expand All @@ -489,7 +489,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: testService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand All @@ -498,7 +498,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) {
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
BackendRef: gatewayv1a2.BackendObjectReference{
Name: specialService,
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
},
Expand Down Expand Up @@ -527,21 +527,21 @@ func TestValidateHTTPPathMatch(t *testing.T) {
}{{
name: "invalid httpRoute prefix",
path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("PathPrefix"),
Type: translate.PathMatchTypePtr("PathPrefix"),
Value: utilpointer.String("/."),
},
errCount: 1,
}, {
name: "invalid httpRoute Exact",
path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("Exact"),
Type: translate.PathMatchTypePtr("Exact"),
Value: utilpointer.String("/foo/./bar"),
},
errCount: 1,
}, {
name: "invalid httpRoute prefix",
path: &gatewayv1a2.HTTPPathMatch{
Type: translator.PathMatchTypePtr("PathPrefix"),
Type: translate.PathMatchTypePtr("PathPrefix"),
Value: utilpointer.String("/"),
},
errCount: 0,
Expand All @@ -558,7 +558,7 @@ func TestValidateHTTPPathMatch(t *testing.T) {
BackendRef: gatewayv1a2.BackendRef{
BackendObjectReference: gatewayv1a2.BackendObjectReference{
Name: gatewayv1a2.ObjectName("test"),
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
}},
Expand Down Expand Up @@ -619,7 +619,7 @@ func TestValidateHTTPHeaderMatches(t *testing.T) {
BackendRef: gatewayv1a2.BackendRef{
BackendObjectReference: gatewayv1a2.BackendObjectReference{
Name: gatewayv1a2.ObjectName("test"),
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
}},
Expand Down Expand Up @@ -683,7 +683,7 @@ func TestValidateHTTPQueryParamMatches(t *testing.T) {
BackendRef: gatewayv1a2.BackendRef{
BackendObjectReference: gatewayv1a2.BackendObjectReference{
Name: gatewayv1a2.ObjectName("test"),
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
}},
Expand Down Expand Up @@ -840,7 +840,7 @@ func TestValidateHTTPRouteTypeMatchesField(t *testing.T) {
Kind: new(gatewayv1a2.Kind),
Name: "name",
Namespace: new(gatewayv1a2.Namespace),
Port: translator.PortNumberPtr(22),
Port: translate.PortNumberPtr(22),
}},
},
errCount: 0,
Expand Down Expand Up @@ -946,7 +946,7 @@ func TestValidateHTTPRouteTypeMatchesField(t *testing.T) {
BackendRef: gatewayv1a2.BackendRef{
BackendObjectReference: gatewayv1a2.BackendObjectReference{
Name: gatewayv1a2.ObjectName("test"),
Port: translator.PortNumberPtr(8080),
Port: translate.PortNumberPtr(8080),
},
},
}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package translator
package translate

import (
gatewayv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package translator
package translate

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package translator
package translate

import (
gatewayv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package translator
package translate

import (
"testing"
Expand Down
Loading

0 comments on commit a1e5a46

Please sign in to comment.