Przeglądaj źródła

[API] Add Topic Config Mock

Oleg Shuralev 5 lat temu
rodzic
commit
30954ba5be
2 zmienionych plików z 136 dodań i 0 usunięć
  1. 132 0
      api/mocks/topicConfig.js
  2. 4 0
      api/services/topics.js

+ 132 - 0
api/mocks/topicConfig.js

@@ -0,0 +1,132 @@
+module.exports = [
+  {
+    key: 'compression.type',
+    value: 'producer',
+    defaultValue: 'producer',
+  },
+  {
+    key: 'leader.replication.throttled.replicas',
+    value: '',
+    defaultValue: '',
+  },
+  {
+    key: 'message.downconversion.enable',
+    value: 'true',
+    defaultValue: 'true',
+  },
+  {
+    key: 'min.insync.replicas',
+    value: '1',
+    defaultValue: '1',
+  },
+  {
+    key: 'segment.jitter.ms',
+    value: '0',
+    defaultValue: '0',
+  },
+  {
+    key: 'cleanup.policy',
+    value: 'delete',
+    defaultValue: 'delete',
+  },
+  {
+    key: 'flush.ms',
+    value: '9223372036854775807',
+    defaultValue: '9223372036854775807',
+  },
+  {
+    key: 'follower.replication.throttled.replicas',
+    value: '',
+    defaultValue: '',
+  },
+  {
+    key: 'segment.bytes',
+    value: '1073741824',
+    defaultValue: '1073741824',
+  },
+  {
+    key: 'retention.ms',
+    value: '43200000',
+    defaultValue: '43200000',
+  },
+  {
+    key: 'flush.messages',
+    value: '9223372036854775807',
+    defaultValue: '9223372036854775807',
+  },
+  {
+    key: 'message.format.version',
+    value: '2.3-IV1',
+    defaultValue: '2.3-IV1',
+  },
+  {
+    key: 'file.delete.delay.ms',
+    value: '60000',
+    defaultValue: '60000',
+  },
+  {
+    key: 'max.compaction.lag.ms',
+    value: '9223372036854775807',
+    defaultValue: '9223372036854775807',
+  },
+  {
+    key: 'max.message.bytes',
+    value: '1000012',
+    defaultValue: '1000012',
+  },
+  {
+    key: 'min.compaction.lag.ms',
+    value: '0',
+    defaultValue: '0',
+  },
+  {
+    key: 'message.timestamp.type',
+    value: 'CreateTime',
+    defaultValue: 'CreateTime',
+  },
+  {
+    key: 'preallocate',
+    value: 'false',
+    defaultValue: 'false',
+  },
+  {
+    key: 'min.cleanable.dirty.ratio',
+    value: '0.5',
+    defaultValue: '0.5',
+  },
+  {
+    key: 'index.interval.bytes',
+    value: '4096',
+    defaultValue: '4096',
+  },
+  {
+    key: 'unclean.leader.election.enable',
+    value: 'true',
+    defaultValue: 'true',
+  },
+  {
+    key: 'retention.bytes',
+    value: '-1',
+    defaultValue: '-1',
+  },
+  {
+    key: 'delete.retention.ms',
+    value: '86400000',
+    defaultValue: '86400000',
+  },
+  {
+    key: 'segment.ms',
+    value: '604800000',
+    defaultValue: '604800000',
+  },
+  {
+    key: 'message.timestamp.difference.max.ms',
+    value: '9223372036854775807',
+    defaultValue: '9223372036854775807',
+  },
+  {
+    key: 'segment.index.bytes',
+    value: '10485760',
+    defaultValue: '10485760',
+  }
+]

+ 4 - 0
api/services/topics.js

@@ -2,6 +2,7 @@
 
 const topics = require('../mocks/topics');
 const topicDetails = require('../mocks/topicDetails');
+const topicConfig = require('../mocks/topicConfig');
 
 module.exports = function (fastify, opts, next) {
   fastify
@@ -10,6 +11,9 @@ module.exports = function (fastify, opts, next) {
     })
     .get('/clusters/:clusterId/topics/:topicId', function (request, reply) {
       reply.send(topicDetails);
+    })
+    .get('/clusters/:clusterId/topics/:topicId/config', function (request, reply) {
+      reply.send(topicConfig);
     });
 
   next();