@@ -60,7 +60,7 @@ final class SwiftPrometheusTests: XCTestCase {
6060 XCTAssertEqual ( counter. get ( ) , 20 )
6161 XCTAssertEqual ( counter. get ( BaseLabels ( myValue: " labels " ) ) , 20 )
6262
63- XCTAssertEqual ( counter. getMetric ( ) , " # HELP my_counter Counter for testing \n # TYPE my_counter counter \n my_counter 20 \n my_counter{myValue= \" labels \" } 20 " )
63+ XCTAssertEqual ( counter. collect ( ) , " # HELP my_counter Counter for testing \n # TYPE my_counter counter \n my_counter 20 \n my_counter{myValue= \" labels \" } 20 " )
6464 }
6565
6666 func testGauge( ) {
@@ -75,7 +75,7 @@ final class SwiftPrometheusTests: XCTestCase {
7575 XCTAssertEqual ( gauge. get ( ) , 20 )
7676 XCTAssertEqual ( gauge. get ( BaseLabels ( myValue: " labels " ) ) , 20 )
7777
78- XCTAssertEqual ( gauge. getMetric ( ) , " # HELP my_gauge Gauge for testing \n # TYPE my_gauge gauge \n my_gauge 20 \n my_gauge{myValue= \" labels \" } 20 " )
78+ XCTAssertEqual ( gauge. collect ( ) , " # HELP my_gauge Gauge for testing \n # TYPE my_gauge gauge \n my_gauge 20 \n my_gauge{myValue= \" labels \" } 20 " )
7979 }
8080
8181 func testHistogram( ) {
@@ -86,7 +86,7 @@ final class SwiftPrometheusTests: XCTestCase {
8686
8787 histogram. observe ( 3 , . init( myValue: " labels " ) )
8888
89- XCTAssertEqual ( histogram. getMetric ( ) , " # HELP my_histogram Histogram for testing \n # TYPE my_histogram histogram \n my_histogram_bucket{myValue= \" * \" , le= \" 0.5 \" } 0.0 \n my_histogram_bucket{myValue= \" * \" , le= \" 1.0 \" } 1.0 \n my_histogram_bucket{myValue= \" * \" , le= \" 2.0 \" } 2.0 \n my_histogram_bucket{myValue= \" * \" , le= \" 3.0 \" } 4.0 \n my_histogram_bucket{myValue= \" * \" , le= \" 5.0 \" } 4.0 \n my_histogram_bucket{myValue= \" * \" , le= \" +Inf \" } 4.0 \n my_histogram_count{myValue= \" * \" } 4.0 \n my_histogram_sum{myValue= \" * \" } 9.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 0.5 \" } 0.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 1.0 \" } 0.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 2.0 \" } 0.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 3.0 \" } 1.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 5.0 \" } 1.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" +Inf \" } 1.0 \n my_histogram_count{myValue= \" labels \" } 1.0 \n my_histogram_sum{myValue= \" labels \" } 3.0 " )
89+ XCTAssertEqual ( histogram. collect ( ) , " # HELP my_histogram Histogram for testing \n # TYPE my_histogram histogram \n my_histogram_bucket{myValue= \" * \" , le= \" 0.5 \" } 0.0 \n my_histogram_bucket{myValue= \" * \" , le= \" 1.0 \" } 1.0 \n my_histogram_bucket{myValue= \" * \" , le= \" 2.0 \" } 2.0 \n my_histogram_bucket{myValue= \" * \" , le= \" 3.0 \" } 4.0 \n my_histogram_bucket{myValue= \" * \" , le= \" 5.0 \" } 4.0 \n my_histogram_bucket{myValue= \" * \" , le= \" +Inf \" } 4.0 \n my_histogram_count{myValue= \" * \" } 4.0 \n my_histogram_sum{myValue= \" * \" } 9.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 0.5 \" } 0.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 1.0 \" } 0.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 2.0 \" } 0.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 3.0 \" } 1.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" 5.0 \" } 1.0 \n my_histogram_bucket{myValue= \" labels \" , le= \" +Inf \" } 1.0 \n my_histogram_count{myValue= \" labels \" } 1.0 \n my_histogram_sum{myValue= \" labels \" } 3.0 " )
9090 }
9191
9292 func testSummary( ) {
@@ -99,6 +99,6 @@ final class SwiftPrometheusTests: XCTestCase {
9999
100100 summary. observe ( 123 , . init( myValue: " labels " ) )
101101
102- XCTAssertEqual ( summary. getMetric ( ) , " # HELP my_summary Summary for testing \n # TYPE my_summary summary \n my_summary{quantile= \" 0.5 \" , myValue= \" * \" } 4.0 \n my_summary{quantile= \" 0.9 \" , myValue= \" * \" } 10000.0 \n my_summary{quantile= \" 0.99 \" , myValue= \" * \" } 10000.0 \n my_summary_count{myValue= \" * \" } 5.0 \n my_summary_sum{myValue= \" * \" } 10130.0 \n my_summary{quantile= \" 0.5 \" , myValue= \" labels \" } 123.0 \n my_summary{quantile= \" 0.9 \" , myValue= \" labels \" } 123.0 \n my_summary{quantile= \" 0.99 \" , myValue= \" labels \" } 123.0 \n my_summary_count{myValue= \" labels \" } 1.0 \n my_summary_sum{myValue= \" labels \" } 123.0 " )
102+ XCTAssertEqual ( summary. collect ( ) , " # HELP my_summary Summary for testing \n # TYPE my_summary summary \n my_summary{quantile= \" 0.5 \" , myValue= \" * \" } 4.0 \n my_summary{quantile= \" 0.9 \" , myValue= \" * \" } 10000.0 \n my_summary{quantile= \" 0.99 \" , myValue= \" * \" } 10000.0 \n my_summary_count{myValue= \" * \" } 5.0 \n my_summary_sum{myValue= \" * \" } 10130.0 \n my_summary{quantile= \" 0.5 \" , myValue= \" labels \" } 123.0 \n my_summary{quantile= \" 0.9 \" , myValue= \" labels \" } 123.0 \n my_summary{quantile= \" 0.99 \" , myValue= \" labels \" } 123.0 \n my_summary_count{myValue= \" labels \" } 1.0 \n my_summary_sum{myValue= \" labels \" } 123.0 " )
103103 }
104104}
0 commit comments