Skip to content

Commit

Permalink
Merge pull request #1426 from tulios/validate-manual-replica-assignment
Browse files Browse the repository at this point in the history
Verify creating topic with manual replica assignment
  • Loading branch information
Nevon committed Jul 26, 2022
2 parents 8a799c6 + a6f60ad commit ff6be44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/admin/__tests__/createTopics.spec.js
Expand Up @@ -93,6 +93,18 @@ describe('Admin', () => {
).resolves.toEqual(true)
})

test('creating topic with manual replica assignment', async () => {
admin = createAdmin({ cluster: createCluster(), logger: newLogger() })

await admin.connect()
await expect(
admin.createTopics({
waitForLeaders: false,
topics: [{ topic: topicName, replicaAssignment: [{ partition: 0, replicas: [0, 1] }] }],
})
).resolves.toEqual(true)
})

test('retries if the controller has moved', async () => {
const cluster = createCluster()
const broker = { createTopics: jest.fn(() => true) }
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Expand Up @@ -238,7 +238,7 @@ export interface ITopicConfig {
topic: string
numPartitions?: number
replicationFactor?: number
replicaAssignment?: object[]
replicaAssignment?: ReplicaAssignment[]
configEntries?: IResourceConfigEntry[]
}

Expand Down

0 comments on commit ff6be44

Please sign in to comment.