You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mz...@apache.org on 2019/07/03 18:59:59 UTC

[mesos] branch master updated: Fixed an compilation issue due to macro expansion.

This is an automated email from the ASF dual-hosted git repository.

mzhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 38438ba  Fixed an compilation issue due to macro expansion.
38438ba is described below

commit 38438baf7be0a4aaef2986531931934e144f6f6a
Author: Meng Zhu <mz...@mesosphere.io>
AuthorDate: Tue Jul 2 15:01:05 2019 -0700

    Fixed an compilation issue due to macro expansion.
    
    Review: https://reviews.apache.org/r/71009
---
 src/tests/registrar_tests.cpp | 221 +++++++++++++++++++++---------------------
 1 file changed, 113 insertions(+), 108 deletions(-)

diff --git a/src/tests/registrar_tests.cpp b/src/tests/registrar_tests.cpp
index 1343b5e..5f0de52 100644
--- a/src/tests/registrar_tests.cpp
+++ b/src/tests/registrar_tests.cpp
@@ -985,31 +985,32 @@ TEST_F(RegistrarTest, UpdateQuota)
 
     EXPECT_EQ(1, registry->quota_configs().size());
 
-    JSON::Array expected = CHECK_NOTERROR(JSON::parse<JSON::Array>(
-    R"~(
-    [
-      {
-        "guarantees": {
-          "cpus": {
-            "value": 1
+    Try<JSON::Array> expected = JSON::parse<JSON::Array>(
+      R"~(
+      [
+        {
+          "guarantees": {
+            "cpus": {
+              "value": 1
+            },
+            "mem": {
+              "value": 1024
+            }
           },
-          "mem": {
-            "value": 1024
-          }
-        },
-        "limits": {
-          "cpus": {
-            "value": 2
+          "limits": {
+            "cpus": {
+              "value": 2
+            },
+            "mem": {
+              "value": 2048
+            }
           },
-          "mem": {
-            "value": 2048
-          }
-        },
-        "role": "role1"
-      }
-    ])~"));
+          "role": "role1"
+        }
+      ])~");
 
-    EXPECT_EQ(expected, JSON::protobuf(registry->quota_configs()));
+    EXPECT_EQ(
+        CHECK_NOTERROR(expected), JSON::protobuf(registry->quota_configs()));
 
     // The `QUOTA_V2` capability is added to the registry.
     //
@@ -1036,50 +1037,51 @@ TEST_F(RegistrarTest, UpdateQuota)
     // NOTE: We assume quota messages are stored in order they have
     // been added.
     // TODO(alexr): Consider removing dependency on the order.
-    JSON::Array expected = CHECK_NOTERROR(JSON::parse<JSON::Array>(
-    R"~(
-    [
-      {
-        "guarantees": {
-          "cpus": {
-            "value": 1
+    Try<JSON::Array> expected = JSON::parse<JSON::Array>(
+      R"~(
+      [
+        {
+          "guarantees": {
+            "cpus": {
+              "value": 1
+            },
+            "mem": {
+              "value": 1024
+            }
           },
-          "mem": {
-            "value": 1024
-          }
-        },
-        "limits": {
-          "cpus": {
-            "value": 2
+          "limits": {
+            "cpus": {
+              "value": 2
+            },
+            "mem": {
+              "value": 2048
+            }
           },
-          "mem": {
-            "value": 2048
-          }
+          "role": "role1"
         },
-        "role": "role1"
-      },
-      {
-        "guarantees": {
-          "cpus": {
-            "value": 1
+        {
+          "guarantees": {
+            "cpus": {
+              "value": 1
+            },
+            "mem": {
+              "value": 1024
+            }
           },
-          "mem": {
-            "value": 1024
-          }
-        },
-        "limits": {
-          "cpus": {
-            "value": 2
+          "limits": {
+            "cpus": {
+              "value": 2
+            },
+            "mem": {
+              "value": 2048
+            }
           },
-          "mem": {
-            "value": 2048
-          }
-        },
-        "role": "role2"
-      }
-    ])~"));
+          "role": "role2"
+        }
+      ])~");
 
-    EXPECT_EQ(expected, JSON::protobuf(registry->quota_configs()));
+    EXPECT_EQ(
+        CHECK_NOTERROR(expected), JSON::protobuf(registry->quota_configs()));
 
     // TODO(mzhu): This assumes the the registry starts empty which might not
     // be in the future. Just check the presence of `QUOTA_V2`.
@@ -1104,38 +1106,39 @@ TEST_F(RegistrarTest, UpdateQuota)
     // NOTE: We assume quota messages are stored in order they have
     // been added.
     // TODO(alexr): Consider removing dependency on the order.
-    JSON::Array expected = CHECK_NOTERROR(JSON::parse<JSON::Array>(
-    R"~(
-    [
-      {
-        "guarantees": {
-          "cpus": {
-            "value": 2
-          }
-        },
-        "limits": {
-          "cpus": {
-            "value": 4
-          }
-        },
-        "role": "role1"
-      },
-      {
-        "guarantees": {
-          "cpus": {
-            "value": 2
-          }
-        },
-        "limits": {
-          "cpus": {
-            "value": 4
-          }
+    Try<JSON::Array> expected = JSON::parse<JSON::Array>(
+      R"~(
+      [
+        {
+          "guarantees": {
+            "cpus": {
+              "value": 2
+            }
+          },
+          "limits": {
+            "cpus": {
+              "value": 4
+            }
+          },
+          "role": "role1"
         },
-        "role": "role2"
-      }
-    ])~"));
+        {
+          "guarantees": {
+            "cpus": {
+              "value": 2
+            }
+          },
+          "limits": {
+            "cpus": {
+              "value": 4
+            }
+          },
+          "role": "role2"
+        }
+      ])~");
 
-    EXPECT_EQ(expected, JSON::protobuf(registry->quota_configs()));
+    EXPECT_EQ(
+        CHECK_NOTERROR(expected), JSON::protobuf(registry->quota_configs()));
 
     // TODO(mzhu): This assumes the the registry starts empty which might not
     // be in the future. Just check the presence of `QUOTA_V2`.
@@ -1157,25 +1160,27 @@ TEST_F(RegistrarTest, UpdateQuota)
 
     configs.Clear();
     *configs.Add() = createQuotaConfig("role1", "cpus:2", "cpus:4");
-    JSON::Array expected = CHECK_NOTERROR(JSON::parse<JSON::Array>(
-    R"~(
-    [
-      {
-        "guarantees": {
-          "cpus": {
-            "value": 2
-          }
-        },
-        "limits": {
-          "cpus": {
-            "value": 4
-          }
-        },
-        "role": "role1"
-      }
-    ])~"));
 
-    EXPECT_EQ(expected, JSON::protobuf(registry->quota_configs()));
+    Try<JSON::Array> expected = JSON::parse<JSON::Array>(
+      R"~(
+      [
+        {
+          "guarantees": {
+            "cpus": {
+              "value": 2
+            }
+          },
+          "limits": {
+            "cpus": {
+              "value": 4
+            }
+          },
+          "role": "role1"
+        }
+      ])~");
+
+    EXPECT_EQ(
+        CHECK_NOTERROR(expected), JSON::protobuf(registry->quota_configs()));
 
     // TODO(mzhu): This assumes the the registry starts empty which might not
     // be in the future. Just check the presence of `QUOTA_V2`.