site_properties_test.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. require('utils/helper');
  19. require('data/HDP2/gluster_fs_properties');
  20. var siteProperties = require('data/HDP2/site_properties').configProperties;
  21. describe('hdp2SiteProperties', function () {
  22. /**
  23. * @stackProperties: All the properties that are derived from stack definition
  24. */
  25. var stackProperties = siteProperties.filter(function(item){
  26. return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals')
  27. });
  28. stackProperties.forEach(function(siteProperty){
  29. /**
  30. * Following config attributes are stack driven and should be defined in the stack metainfo instead of ambari-web site-properties file
  31. * isVisible
  32. * isOverridable
  33. * value
  34. * recommendedValue
  35. * isReconfigurable
  36. * isRequired
  37. * displayName
  38. * description
  39. * showLabel
  40. * unit
  41. */
  42. describe('Check attributes of "{0}/{1}". Stack driven attributes should be undefined '.format(siteProperty.filename, siteProperty.name), function () {
  43. ['isVisible', 'value', 'recommendedValue', 'description', 'isReconfigurable', 'isRequired', 'displayName', 'showLabel', 'unit'].forEach(function (p) {
  44. it(p, function () {
  45. expect(siteProperty[p]).to.not.exist;
  46. });
  47. });
  48. });
  49. /**
  50. * displayTypes <code>supportTextConnection<code> and <code>radio button<code>
  51. * can be used as exception. Other displayTypes values should be used in stack definition
  52. */
  53. it('Check attributes of "{0}/{1}". Display type value {2} should be described in stack '.format(siteProperty.filename, siteProperty.name, siteProperty.displayType), function () {
  54. expect(siteProperty.displayType).to.match(/undefined|supportTextConnection|radio button/);
  55. });
  56. /**
  57. * Following config attributes uniquely represent a config property
  58. * name
  59. * filename
  60. */
  61. describe('Check primary attributes of "{0}/{1}". Attributes that uniquely represent a property should be defined '.format(siteProperty.filename, siteProperty.name), function () {
  62. it('name', function () {
  63. expect(siteProperty.name).to.not.equal(undefined);
  64. });
  65. it('filename', function () {
  66. expect(siteProperty.filename).to.not.equal(undefined);
  67. });
  68. });
  69. });
  70. });