1. 11 Oct, 2023 2 commits
    • Kirill Smelkov's avatar
      promise/plugin/*: Do not replace ' -> " in input JSON data · b067cc0e
      Kirill Smelkov authored
      Adjust promises correspondingly to slapos!1447
      which changed ors-amarisoft software-release to emit log payload via
      json.dumps instead of py %s.
      
      Do this for both promises code and JSON-loading utilities in slapos/promise/plugin/util.py also used inside ORS promises code.
      We can adjust the utilities because there are two of them (get_json_log_data_interval and get_json_log_latest_timestamp) with
      get_json_log_latest_timestamp being used only in ORS-promises:
      
          slapos.toolbox$ git grep get_json_log_latest_timestamp
          slapos/promise/plugin/check_amarisoft_stats_log.py:from .util import get_json_log_latest_timestamp
          slapos/promise/plugin/check_amarisoft_stats_log.py:    latest_timestamp = get_json_log_latest_timestamp(self.amarisoft_stats_log)
          slapos/promise/plugin/util.py:def get_json_log_latest_timestamp(json_log_file):
      
      and get_json_log_data_interval being used in ORS promises and
      check_cpu_temperature, check_network_transit and check_ram_usage:
      
          slapos.toolbox$ git grep get_json_log_data_interval
          slapos/promise/plugin/check_baseband_latency.py:from .util import get_json_log_data_interval
          slapos/promise/plugin/check_baseband_latency.py:    data_list = get_json_log_data_interval(self.amarisoft_stats_log, self.stats_period * 5)
          slapos/promise/plugin/check_cpu_temperature.py:      temp_list = self.get_json_log_data_interval(self.avg_temp_duration)
          slapos/promise/plugin/check_network_transit.py:      temp_list = self.get_json_log_data_interval(self.transit_period)
          slapos/promise/plugin/check_ram_usage.py:      temp_list = self.get_json_log_data_interval(self.avg_ram_period)
          slapos/promise/plugin/check_rx_saturated.py:from .util import get_json_log_data_interval
          slapos/promise/plugin/check_rx_saturated.py:    data_list = get_json_log_data_interval(self.amarisoft_stats_log, self.stats_period * 2)
          slapos/promise/plugin/util.py:def get_json_log_data_interval(json_log_file, interval):
          slapos/promise/plugin/util.py:  def get_json_log_data_interval(self, interval):
          slapos/promise/plugin/util.py:    return get_json_log_data_interval(self.__json_log_file, interval)
      
      However all check_cpu_temperature, check_network_transit and
      check_ram_usage produce their *.json.log files themselves and already
      emit `data` via json.dumps:
      
      https://lab.nexedi.com/nexedi/slapos.toolbox/blob/453dce5f/slapos/promise/plugin/check_cpu_temperature.py#L41-54
      https://lab.nexedi.com/nexedi/slapos.toolbox/blob/453dce5f/slapos/promise/plugin/check_network_transit.py#L29-42
      https://lab.nexedi.com/nexedi/slapos.toolbox/blob/453dce5f/slapos/promise/plugin/check_ram_usage.py#L34-46
      
      So it is safe to adjust the utilities.
      b067cc0e
    • Kirill Smelkov's avatar
      tests/promise/plugin: Adjust Amarisoft-related tests to match... · cbe9c822
      Kirill Smelkov authored
      tests/promise/plugin: Adjust Amarisoft-related tests to match amarisoft_stats.json.log emitted by SR
      
      In slapos@b32b4a8e `data` field in
      that log switched from emitting objects via py repr to emitting them via
      JSON. As the result, in particular, strings are now emitted quoted with
      " instead of with ' .
      
      -> Adjust all tests that simulate amarisoft_stats.json.log to follow
      actual software-release behaviour.
      
      The tests continue to pass.
      cbe9c822
  2. 22 Sep, 2023 2 commits
  3. 21 Sep, 2023 4 commits
  4. 07 Aug, 2023 1 commit
  5. 15 Jun, 2023 1 commit
  6. 08 Jun, 2023 1 commit
  7. 16 May, 2023 3 commits
  8. 15 May, 2023 1 commit
  9. 31 Mar, 2023 1 commit
  10. 20 Mar, 2023 2 commits
  11. 09 Mar, 2023 13 commits
  12. 07 Mar, 2023 1 commit
  13. 06 Mar, 2023 1 commit
  14. 03 Mar, 2023 1 commit
  15. 01 Mar, 2023 3 commits
  16. 08 Feb, 2023 3 commits