# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This file is used to show how to write configuration files and can be used to test.

cases:
  # service cases
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
    expected: expected/service.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_uptime --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-ins.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_data_size --service-name=mongodb::replset
    expected: expected/metrics-has-value-label.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_collection_count --service-name=mongodb::replset
    expected: expected/metrics-has-value-label.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_object_count --service-name=mongodb::replset
    expected: expected/metrics-has-value-label.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_document_avg_qps --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-doc-service_instance_id.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_operation_avg_qps --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-legacy-service_instance_id.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_connections --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-ins.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_cursor_avg --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-csr-service_instance_id.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_repl_lag --service-name=mongodb::replset
    expected: expected/metrics-has-value-label.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_db_data_size --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-database-service_instance_id.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_db_index_size --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-database-service_instance_id.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_db_collection_count --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-database-service_instance_id.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_cluster_db_index_count --service-name=mongodb::replset
    expected: expected/metrics-has-value-label-database-service_instance_id.yml

  # instance cases
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql instance ls --service-name=mongodb::replset
    expected: expected/instance.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_uptime --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_qps --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_op_rate --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-op.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_latency_rate --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-op.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_memory_usage --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_version --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-version.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_rs_state --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-member.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_cpu_total_percentage --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_network_bytes_in --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_network_bytes_out --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_memory_free_kb --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_swap_memory_free_kb --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_fs_used_size --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_fs_total_size --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_connections --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_active_total_num --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_active_reader_num --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_active_writer_num --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_transactions_active --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_transactions_inactive --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_document_qps --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-doc.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_operation_qps --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-legacy.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_repl_operation_qps --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-legacy.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_cursor --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-csr.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_mem_virtual --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_mem_resident --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_asserts --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-assert.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_repl_buffer_count --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_repl_buffer_size --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_repl_buffer_size_max --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_queued_operation --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value-label-count.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_write_wait_num --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_write_wait_timeout_num --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_mongodb_node_write_wait_time --service-name=mongodb::replset --instance-name=mongodb-exporter-1:9216
    expected: expected/metrics-has-value.yml
