[ 
https://issues.apache.org/jira/browse/KARAF-6877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17331242#comment-17331242
 ] 

Vassil Zorev edited comment on KARAF-6877 at 4/24/21, 3:34 PM:
---------------------------------------------------------------

Hello,

Some things to mention. I played around a bit to load the init script in the 
itests session. It "kind of worked", but not fully :) Let me explain.

There is a call to 
org.apache.karaf.itests.KarafTestSupport#waitForCommandService for each command 
execution, but this waits up to 6 minutes that a command service is available. 
From what i found so far, "regular" commands implement 
org.apache.karaf.shell.api.console.Command, but aliases don't. So not sure how 
the KarafTestSupport can recognize aliases and skip the waiting for them ?
 Just for information, i temporarilly decreased the timeout to 30sec, then 
tried to call

{{executeCommand("la", ADMIN_ROLES)}}

within org.apache.karaf.itests.BundleTest#listCommand and (after 30s) it 
returned the same result as "bundle:list -t 0". However the general problem 
with alias recognizing remains (for me at least.. )

Again, I'm sorry if this is the wrong place to discuss how to solve/implement 
Jira issues, please let me kwow if there is a different place for such 
discussions.

Vassil

Edit: maybe if we there is a way to map "la" to "bundle:list" in 
KarafTestSupport and call waitForCommandService() on "bundle:list" instead..


was (Author: vassilz):
Hello,

Some things to mention. I played around a bit to load the init script in the 
itests session. It "kind of worked", but not fully :) Let me explain.

There is a call to 
org.apache.karaf.itests.KarafTestSupport#waitForCommandService for each command 
execution, but this waits up to 6 minutes that a command service is available. 
From what i found so far, "regular" commands implement 
org.apache.karaf.shell.api.console.Command, but aliases don't. So not sure how 
the KarafTestSupport can recognize aliases and skip the waiting for them ?
Just for information, i temporarilly decreased the timeout to 30sec, then tried 
to call

{{executeCommand("la", ADMIN_ROLES)}}

within org.apache.karaf.itests.BundleTest#listCommand and (after 30s) it 
returned the same result as "bundle:list -t 0". However the general problem 
with alias recognizing remains (for me at least.. )


Again, I'm sorry if this is the wrong place to discuss how to solve/implement 
Jira issues, please let me kwow if there is a different place for such 
discussions.

Vassil

> Itest doesn't see alias command
> -------------------------------
>
>                 Key: KARAF-6877
>                 URL: https://issues.apache.org/jira/browse/KARAF-6877
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>            Reporter: Jean-Baptiste Onofré
>            Priority: Major
>
> When executing an alias (defined in {{etc/shell.init.script}}) in an itest 
> (using {{executeCommand()}} for instance), the command is not found.
> The alias should be loaded.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to