service_metrics_mapper_test.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with this
  4. * work for additional information regarding copyright ownership. The ASF
  5. * licenses this file to you under the Apache License, Version 2.0 (the
  6. * "License"); you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations under
  15. * the License.
  16. */
  17. var App = require('app');
  18. describe('App.serviceMetricsMapper', function () {
  19. describe('#yarnMapper', function () {
  20. it('should set ACTIVE RM first in any cases (if RM HA enabled)', function() {
  21. var item = {
  22. components: [
  23. {
  24. ServiceComponentInfo: {
  25. component_name: 'RESOURCEMANAGER'
  26. },
  27. host_components: [
  28. {
  29. HostRoles: {
  30. ha_state: null,
  31. host_name : 'h1'
  32. }
  33. },
  34. {
  35. HostRoles: {
  36. ha_state: 'ACTIVE',
  37. host_name : 'h2'
  38. },
  39. metrics: {
  40. yarn: {
  41. Queue: {
  42. root: {
  43. default: {}
  44. }
  45. }
  46. }
  47. }
  48. }
  49. ]
  50. }
  51. ]
  52. },
  53. result = App.serviceMetricsMapper.yarnMapper(item);
  54. expect(result.queue).to.equal("{\"root\":{\"default\":{}}}");
  55. });
  56. });
  57. });