$:.push File.expand_path("../../lib", __FILE__) require 'helix_web_services_client' require_relative './util/test_config' require_relative './util/string_utils' require 'pp' api = api_as_super rand = random_string counter_id = "test-counter-#{random_string}" counter = HelixWebServices::Counter.new( value: '1' ) api.server_counters_counter_put('localhost', counter_id, counter) all_counters = api.server_counters_get('localhost') unless all_counters.any? { |b| b.counter == counter_id && b.value == '1' } raise "Did not locate counter #{counter_id} or value is not 1" end saved_counter = api.server_counters_counter_get('localhost', counter_id) unless saved_counter.value == counter.value raise "Didn't fetch saved counter #{counter_id} with expected value" end api.server_counters_counter_increment_post('localhost', counter_id) updated = api.server_counters_counter_get('localhost', counter_id) unless updated.value == '2' raise "Didn't increment counter to 2" end api.server_counters_counter_delete('localhost', counter_id) all_counters2 = api.server_counters_get('localhost') unless all_counters2.all? { |b| b.counter != counter_id } raise "Did not delete counter #{counter_id}" end