sinkMeta_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2021 EMQ Technologies Co., Ltd.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package meta
  15. import (
  16. "testing"
  17. )
  18. func TestHintWhenModifySink(t *testing.T) {
  19. taosMeta := &uiSink{
  20. Fields: []field{
  21. {
  22. Name: "ip",
  23. Default: "911.911.911.911",
  24. },
  25. },
  26. }
  27. logMeta := &uiSink{
  28. Fields: []field{
  29. {
  30. Name: "ip",
  31. Default: "911.911.911.911",
  32. },
  33. },
  34. }
  35. gSinkmetadata = make(map[string]*uiSink)
  36. gSinkmetadata["taos.json"] = taosMeta
  37. gSinkmetadata["log.json"] = logMeta
  38. oldSink, err := GetSinkMeta("taos", "en_US")
  39. if err != nil {
  40. t.Errorf("%v", err)
  41. } else {
  42. if "911.911.911.911" != oldSink.Fields[0].Default {
  43. t.Errorf("fail")
  44. }
  45. }
  46. }