pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] merlimat closed pull request #2820: Specify default for cpu/ram/disk
Date Tue, 23 Oct 2018 05:57:28 GMT
merlimat closed pull request #2820: Specify default for cpu/ram/disk
URL: https://github.com/apache/pulsar/pull/2820
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
index a050997894..67518d5faa 100644
--- a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
+++ b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
@@ -477,72 +477,6 @@ public void testInvalidJar() throws Exception {
         );
     }
 
-    @Test
-    public void testMissingCpu() throws Exception {
-        SinkConfig sinkConfig = getSinkConfig();
-        sinkConfig.setResources(new Resources(null, RAM, DISK));
-        testCmdSinkCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                INPUTS,
-                TOPIC_PATTERN,
-                CUSTOM_SERDE_INPUT_STRING,
-                PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                null,
-                RAM,
-                DISK,
-                SINK_CONFIG_STRING,
-                sinkConfig
-        );
-    }
-
-    @Test
-    public void testMissingRam() throws Exception {
-        SinkConfig sinkConfig = getSinkConfig();
-        sinkConfig.setResources(new Resources(CPU, null, DISK));
-        testCmdSinkCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                INPUTS,
-                TOPIC_PATTERN,
-                CUSTOM_SERDE_INPUT_STRING,
-                PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                CPU,
-                null,
-                DISK,
-                SINK_CONFIG_STRING,
-                sinkConfig
-        );
-    }
-
-    @Test
-    public void testMissingDisk() throws Exception {
-        SinkConfig sinkConfig = getSinkConfig();
-        sinkConfig.setResources(new Resources(CPU, RAM, null));
-        testCmdSinkCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                INPUTS,
-                TOPIC_PATTERN,
-                CUSTOM_SERDE_INPUT_STRING,
-                PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                CPU,
-                RAM,
-                null,
-                SINK_CONFIG_STRING,
-                sinkConfig
-        );
-    }
-
     @Test
     public void testMissingConfig() throws Exception {
         SinkConfig sinkConfig = getSinkConfig();
diff --git a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
index 318dbe65cf..63574f9a6c 100644
--- a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
+++ b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
@@ -371,63 +371,6 @@ public void testInvalidJarWithNoSource() throws Exception {
         );
     }
 
-    @Test
-    public void testMissingCpu() throws Exception {
-        SourceConfig sourceConfig = getSourceConfig();
-        sourceConfig.setResources(new Resources(null, RAM, DISK));
-        testCmdSourceCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                TOPIC_NAME, SERDE_CLASS_NAME, PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                null,
-                RAM,
-                DISK,
-                SINK_CONFIG_STRING,
-                sourceConfig
-        );
-    }
-
-    @Test
-    public void testMissingRam() throws Exception {
-        SourceConfig sourceConfig = getSourceConfig();
-        sourceConfig.setResources(new Resources(CPU, null, DISK));
-        testCmdSourceCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                TOPIC_NAME, SERDE_CLASS_NAME, PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                CPU,
-                null,
-                DISK,
-                SINK_CONFIG_STRING,
-                sourceConfig
-        );
-    }
-
-    @Test
-    public void testMissingDisk() throws Exception {
-        SourceConfig sourceConfig = getSourceConfig();
-        sourceConfig.setResources(new Resources(CPU, RAM, null));
-        testCmdSourceCliMissingArgs(
-                TENANT,
-                NAMESPACE,
-                NAME,
-                TOPIC_NAME, SERDE_CLASS_NAME, PROCESSING_GUARANTEES,
-                PARALLELISM,
-                JAR_FILE_PATH,
-                CPU,
-                RAM,
-                null,
-                SINK_CONFIG_STRING,
-                sourceConfig
-        );
-    }
-
     @Test
     public void testMissingConfig() throws Exception {
         SourceConfig sourceConfig = getSourceConfig();
diff --git a/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Resources.java
b/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Resources.java
index 5c707fac4b..fc187f79e1 100644
--- a/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Resources.java
+++ b/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Resources.java
@@ -28,7 +28,10 @@
 @AllArgsConstructor
 @NoArgsConstructor
 public class Resources {
-    private Double cpu;
-    private Long ram;
-    private Long disk;
+    // Default cpu is 1 core
+    private Double cpu = 1d;
+    // Default memory is 1GB
+    private Long ram = 1073741824l;
+    // Default disk is 10GB
+    private Long disk = 10737418240l;
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message