@@ -1530,86 +1530,85 @@ class UninitializedAdmin(AdminClient):
15301530 def __init__ (self , config ):
15311531 # Don't call super().__init__() - leaves self->rk as NULL
15321532 pass
1533-
1533+
15341534 admin = UninitializedAdmin ({})
1535-
1536-
1535+
15371536 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15381537 admin .create_topics ([NewTopic ("test" , 1 , 1 )])
1539-
1538+
15401539 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15411540 admin .delete_topics (["test" ])
1542-
1541+
15431542 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15441543 admin .create_partitions ([NewPartitions ("test" , 2 )])
1545-
1544+
15461545 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15471546 admin .describe_configs ([ConfigResource (ResourceType .TOPIC , "test" )])
1548-
1547+
15491548 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15501549 admin .incremental_alter_configs ([ConfigResource (ResourceType .TOPIC , "test" )])
1551-
1550+
15521551 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15531552 admin .alter_configs ([ConfigResource (ResourceType .TOPIC , "test" )])
1554-
1553+
15551554 acl_binding = AclBinding (
15561555 ResourceType .TOPIC , "topic1" , ResourcePatternType .LITERAL ,
15571556 "User:u1" , "*" , AclOperation .WRITE , AclPermissionType .ALLOW
15581557 )
1559-
1558+
15601559 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15611560 admin .create_acls ([acl_binding ])
1562-
1561+
15631562 acl_filter = AclBindingFilter (ResourceType .ANY , None , ResourcePatternType .ANY ,
1564- None , None , AclOperation .ANY , AclPermissionType .ANY )
1565-
1563+ None , None , AclOperation .ANY , AclPermissionType .ANY )
1564+
15661565 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15671566 admin .delete_acls ([acl_filter ])
1568-
1567+
15691568 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15701569 admin .describe_acls (acl_filter )
1571-
1570+
15721571 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15731572 admin .list_consumer_groups ()
1574-
1573+
15751574 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15761575 admin .describe_user_scram_credentials (["user" ])
1577-
1576+
15781577 scram_info = ScramCredentialInfo (ScramMechanism .SCRAM_SHA_256 , 10000 )
15791578 upsertion = UserScramCredentialUpsertion ("user" , scram_info , b"password" )
1580-
1579+
15811580 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15821581 admin .alter_user_scram_credentials ([upsertion ])
1583-
1582+
15841583 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15851584 admin .describe_consumer_groups (["group" ])
1586-
1585+
15871586 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15881587 admin .describe_topics (TopicCollection (["topic" ]))
1589-
1588+
15901589 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15911590 admin .describe_cluster ()
1592-
1591+
15931592 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15941593 admin .delete_consumer_groups (["group" ])
1595-
1594+
15961595 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
15971596 admin .list_consumer_group_offsets ([ConsumerGroupTopicPartitions ("group" )])
1598-
1597+
15991598 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
16001599 admin .alter_consumer_group_offsets ([ConsumerGroupTopicPartitions ("group" , [TopicPartition ("topic" , 0 , 5 )])])
1601-
1600+
16021601 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
16031602 admin .list_offsets ({TopicPartition ("topic" , 0 , 10 ): OffsetSpec .earliest ()})
1604-
1603+
16051604 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
16061605 admin .delete_records ([TopicPartition ("topic" , 0 , 10 )])
1607-
1606+
16081607 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
16091608 admin .elect_leaders (ElectionType .PREFERRED , [TopicPartition ("topic" , 0 )])
1610-
1609+
16111610 with pytest .raises (RuntimeError , match = "AdminClient has been closed" ):
16121611 admin .poll (0.001 )
1613-
1612+
16141613 # Test __len__() - should return 0 for closed admin (safe, no crash)
16151614 assert len (admin ) == 0
0 commit comments