process_test.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package render_test
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/weaveworks/common/test"
  6. "github.com/weaveworks/scope/render"
  7. "github.com/weaveworks/scope/render/expected"
  8. "github.com/weaveworks/scope/test/fixture"
  9. "github.com/weaveworks/scope/test/reflect"
  10. "github.com/weaveworks/scope/test/utils"
  11. )
  12. func TestEndpointRenderer(t *testing.T) {
  13. have := utils.Prune(render.EndpointRenderer.Render(context.Background(), fixture.Report).Nodes)
  14. want := utils.Prune(expected.RenderedEndpoints)
  15. if !reflect.DeepEqual(want, have) {
  16. t.Error(test.Diff(want, have))
  17. }
  18. }
  19. func TestProcessRenderer(t *testing.T) {
  20. have := utils.Prune(render.ProcessRenderer.Render(context.Background(), fixture.Report).Nodes)
  21. want := utils.Prune(expected.RenderedProcesses)
  22. if !reflect.DeepEqual(want, have) {
  23. t.Error(test.Diff(want, have))
  24. }
  25. }
  26. func TestProcessNameRenderer(t *testing.T) {
  27. have := utils.Prune(render.ProcessNameRenderer.Render(context.Background(), fixture.Report).Nodes)
  28. want := utils.Prune(expected.RenderedProcessNames)
  29. if !reflect.DeepEqual(want, have) {
  30. t.Error(test.Diff(want, have))
  31. }
  32. }