github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/clients/pkg/promtail/targets/gcplog/push_translation_test.go (about) 1 package gcplog 2 3 import ( 4 "testing" 5 ) 6 7 func TestConvertToLokiCompatibleLabel(t *testing.T) { 8 type args struct { 9 label string 10 } 11 tests := []struct { 12 name string 13 args args 14 want string 15 }{ 16 { 17 name: "Google timestamp label attribute name", 18 args: args{ 19 label: "logging.googleapis.com/timestamp", 20 }, 21 want: "logging_googleapis_com_timestamp", 22 }, 23 } 24 for _, tt := range tests { 25 t.Run(tt.name, func(t *testing.T) { 26 if got := convertToLokiCompatibleLabel(tt.args.label); got != tt.want { 27 t.Errorf("convertToLokiCompatibleLabel() = %v, want %v", got, tt.want) 28 } 29 }) 30 } 31 }