frankgh commented on code in PR #4408:
URL: https://github.com/apache/cassandra/pull/4408#discussion_r2408924576
##########
pylib/cqlshlib/test/test_cqlsh_completion.py:
##########
@@ -1048,12 +1048,12 @@ def test_complete_in_use(self):
'system_virtual_schema',
'system_cluster_metadata'])
def test_complete_in_create_index(self):
- self.trycompletions('CREATE I', immediate='NDEX ')
+ self.trycompletions('CREATE IN', immediate='DEX ')
Review Comment:
why is this change needed? This change is not necessary.
##########
pylib/cqlshlib/test/test_cqlsh_completion.py:
##########
@@ -1205,18 +1211,45 @@ def test_complete_in_alter_role(self):
self.trycompletions('ALTER ROLE foo WITH ACCESS TO ', choices=['ALL',
'DATACENTERS'])
self.trycompletions('ALTER ROLE foo WITH ACCESS FROM ',
choices=['ALL', 'CIDRS'])
- def test_complete_in_create_user(self):
- self.trycompletions('CREATE USER ', choices=['<username>', 'IF'])
- self.trycompletions('CREATE USER IF ', immediate='NOT EXISTS ')
def test_complete_in_drop_role(self):
self.trycompletions('DROP ROLE ', choices=['<identifier>', 'IF',
'<quotedName>'])
+
+ # IDENTITY checks
+ def test_complete_in_add_identity(self):
+ self.trycompletions('ADD ID', immediate='ENTITY ')
+ self.trycompletions('ADD IDENTITY IF ', immediate='NOT EXISTS ')
+ self.trycompletions('ADD IDENTITY IF NOT ', immediate='EXISTS ')
+ self.trycompletions('ADD IDENTITY ',
+ choices=['<pgStringLiteral>', '<quotedStringLiteral>', 'IF'])
+ self.trycompletions("ADD IDENTITY '[email protected]' TO R",
immediate='OLE ')
+ self.trycompletions("ADD IDENTITY '[email protected]' ", immediate='TO
ROLE ')
+ self.trycompletions("ADD IDENTITY '[email protected]' TO ROLE ",
+ choices=['<identifier>', '<quotedName>'],
other_choices_ok=True)
+ self.trycompletions("ADD IDENTITY '[email protected]' TO ROLE
data_engineer ",
+ choices=[';'])
+ self.trycompletions("ADD IDENTITY IF NOT EXISTS '[email protected]' TO
ROLE data_engineer ",
+ choices=[';'])
+
+ def test_complete_in_drop_identity(self):
+ self.trycompletions('DROP IDENTITY ',
+ choices=['<pgStringLiteral>',
'<quotedStringLiteral>', 'IF'])
+ self.trycompletions('DROP IDENTITY IF ', immediate='EXISTS ')
+ self.trycompletions('DROP IDENTITY IF EXISTS ',
+ choices=['<pgStringLiteral>',
'<quotedStringLiteral>'])
+ self.trycompletions("DROP IDENTITY '[email protected]' ",
choices=[';'])
+ self.trycompletions("DROP IDENTITY IF EXISTS '[email protected]' ",
choices=[';'])
+
def test_complete_in_list(self):
self.trycompletions('LIST ',
choices=['ALL', 'AUTHORIZE', 'DESCRIBE',
'EXECUTE', 'ROLES', 'USERS', 'ALTER',
'CREATE', 'DROP', 'MODIFY', 'SELECT',
'UNMASK', 'SELECT_MASKED', 'SUPERUSERS'])
+ def test_complete_drop_end(self):
Review Comment:
this is unrelated to this PR
##########
pylib/cqlshlib/test/test_cqlsh_completion.py:
##########
@@ -1205,18 +1211,45 @@ def test_complete_in_alter_role(self):
self.trycompletions('ALTER ROLE foo WITH ACCESS TO ', choices=['ALL',
'DATACENTERS'])
self.trycompletions('ALTER ROLE foo WITH ACCESS FROM ',
choices=['ALL', 'CIDRS'])
- def test_complete_in_create_user(self):
- self.trycompletions('CREATE USER ', choices=['<username>', 'IF'])
- self.trycompletions('CREATE USER IF ', immediate='NOT EXISTS ')
def test_complete_in_drop_role(self):
self.trycompletions('DROP ROLE ', choices=['<identifier>', 'IF',
'<quotedName>'])
+
+ # IDENTITY checks
+ def test_complete_in_add_identity(self):
+ self.trycompletions('ADD ID', immediate='ENTITY ')
Review Comment:
Can we try adding completion for :
- `A`
- `AD`
##########
pylib/cqlshlib/test/test_cqlsh_completion.py:
##########
@@ -1184,9 +1184,15 @@ def test_complete_in_alter_type(self):
self.trycompletions('ALTER TYPE IF EXISTS new_type ADD IF NOT EXISTS
', choices=['<new_field_name>'])
self.trycompletions('ALTER TYPE IF EXISTS new_type RENAME ',
choices=['IF', '<quotedName>', '<identifier>'])
+ # USER checks
+ def test_complete_in_create_user(self):
+ self.trycompletions('CREATE USER ', choices=['<username>', 'IF'])
+ self.trycompletions('CREATE USER IF ', immediate='NOT EXISTS ')
Review Comment:
No, I think we should only have changes related to this PR. I recommend that
we have a dedicated JIRA for this change
##########
pylib/cqlshlib/test/test_cqlsh_completion.py:
##########
@@ -1205,18 +1211,45 @@ def test_complete_in_alter_role(self):
self.trycompletions('ALTER ROLE foo WITH ACCESS TO ', choices=['ALL',
'DATACENTERS'])
self.trycompletions('ALTER ROLE foo WITH ACCESS FROM ',
choices=['ALL', 'CIDRS'])
- def test_complete_in_create_user(self):
- self.trycompletions('CREATE USER ', choices=['<username>', 'IF'])
- self.trycompletions('CREATE USER IF ', immediate='NOT EXISTS ')
def test_complete_in_drop_role(self):
self.trycompletions('DROP ROLE ', choices=['<identifier>', 'IF',
'<quotedName>'])
+
+ # IDENTITY checks
+ def test_complete_in_add_identity(self):
+ self.trycompletions('ADD ID', immediate='ENTITY ')
+ self.trycompletions('ADD IDENTITY IF ', immediate='NOT EXISTS ')
+ self.trycompletions('ADD IDENTITY IF NOT ', immediate='EXISTS ')
+ self.trycompletions('ADD IDENTITY ',
+ choices=['<pgStringLiteral>', '<quotedStringLiteral>', 'IF'])
+ self.trycompletions("ADD IDENTITY '[email protected]' TO R",
immediate='OLE ')
+ self.trycompletions("ADD IDENTITY '[email protected]' ", immediate='TO
ROLE ')
+ self.trycompletions("ADD IDENTITY '[email protected]' TO ROLE ",
+ choices=['<identifier>', '<quotedName>'],
other_choices_ok=True)
+ self.trycompletions("ADD IDENTITY '[email protected]' TO ROLE
data_engineer ",
+ choices=[';'])
+ self.trycompletions("ADD IDENTITY IF NOT EXISTS '[email protected]' TO
ROLE data_engineer ",
+ choices=[';'])
+
+ def test_complete_in_drop_identity(self):
+ self.trycompletions('DROP IDENTITY ',
Review Comment:
Can we try autocompletion for:
- `D`
- `DR`
- `DROP I`
- `DROP ID`
- `DROP IDENTITY IF `
- ...
##########
pylib/cqlshlib/test/test_cqlsh_completion.py:
##########
@@ -1048,12 +1048,12 @@ def test_complete_in_use(self):
'system_virtual_schema',
'system_cluster_metadata'])
def test_complete_in_create_index(self):
- self.trycompletions('CREATE I', immediate='NDEX ')
+ self.trycompletions('CREATE IN', immediate='DEX ')
self.trycompletions('CREATE INDEX ', choices=['<new_index_name>',
'IF', 'ON'])
self.trycompletions('CREATE INDEX example ', immediate='ON ')
def test_complete_in_drop_index(self):
- self.trycompletions('DROP I', immediate='NDEX ')
+ self.trycompletions('DROP IN', immediate='DEX ')
Review Comment:
I think we should preserve this completion and follow up with your change
here
```suggestion
self.trycompletions('DROP I', choices=['DENTITY', 'NDEX '])
self.trycompletions('DROP IN', immediate='DEX ')
```
##########
pylib/cqlshlib/test/test_cqlsh_completion.py:
##########
@@ -1205,18 +1211,45 @@ def test_complete_in_alter_role(self):
self.trycompletions('ALTER ROLE foo WITH ACCESS TO ', choices=['ALL',
'DATACENTERS'])
self.trycompletions('ALTER ROLE foo WITH ACCESS FROM ',
choices=['ALL', 'CIDRS'])
- def test_complete_in_create_user(self):
- self.trycompletions('CREATE USER ', choices=['<username>', 'IF'])
- self.trycompletions('CREATE USER IF ', immediate='NOT EXISTS ')
def test_complete_in_drop_role(self):
self.trycompletions('DROP ROLE ', choices=['<identifier>', 'IF',
'<quotedName>'])
+
+ # IDENTITY checks
+ def test_complete_in_add_identity(self):
+ self.trycompletions('ADD ID', immediate='ENTITY ')
+ self.trycompletions('ADD IDENTITY IF ', immediate='NOT EXISTS ')
+ self.trycompletions('ADD IDENTITY IF NOT ', immediate='EXISTS ')
+ self.trycompletions('ADD IDENTITY ',
+ choices=['<pgStringLiteral>', '<quotedStringLiteral>', 'IF'])
+ self.trycompletions("ADD IDENTITY '[email protected]' TO R",
immediate='OLE ')
Review Comment:
we should use a `urn` for the identity example. I think it'd make more sense
to base it on something that represents the actual usage
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]