Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aunit run for packages does not work on 740 #18

Open
fabianlupa opened this issue Sep 5, 2019 · 3 comments
Open

aunit run for packages does not work on 740 #18

fabianlupa opened this issue Sep 5, 2019 · 3 comments

Comments

@fabianlupa
Copy link
Contributor

Do you mind if I open issues where the cause might be a 740 SP20 backend?

Request using ADT:

<?xml version="1.0" encoding="UTF-8"?>
<aunit:runConfiguration xmlns:aunit="http://www.sap.com/adt/aunit">
  <external>
    <coverage active="false"/>
  </external>
  <adtcore:objectSets xmlns:adtcore="http://www.sap.com/adt/core">
    <objectSet kind="inclusive">
      <adtcore:objectReferences>
        <adtcore:objectReference adtcore:uri="/sap/bc/adt/vit/wb/object_type/devck/object_name/%2fABC%2fPACKAGE"/>
      </adtcore:objectReferences>
    </objectSet>
  </adtcore:objectSets>
</aunit:runConfiguration>

Request using sapcli ./sapcli aunit run package "/ABC/PACKAGE":

<?xml version="1.0" encoding="UTF-8"?>
<aunit:runConfiguration xmlns:aunit="http://www.sap.com/adt/aunit">
  <external>
    <coverage active="false"/>
  </external>
  <options>
    <uriType value="semantic"/>
    <testDeterminationStrategy appendAssignedTestsPreview="true" assignedTests="false" sameProgram="true"/>
    <testRiskLevels critical="true" dangerous="true" harmless="true"/>
    <testDurations long="true" medium="true" short="true"/>
  </options>
  <adtcore:objectSets xmlns:adtcore="http://www.sap.com/adt/core">
    <objectSet kind="inclusive">
      <adtcore:objectReferences>
        <adtcore:objectReference adtcore:uri="/sap/bc/adt/packages/%2Fabc%2Fpackage"/>
      </adtcore:objectReferences>
    </objectSet>
  </adtcore:objectSets>
</aunit:runConfiguration>

Result:

<?xml version="1.0" encoding="UTF-8"?>
<aunit:runResult xmlns:aunit="http://www.sap.com/adt/aunit">
  <alerts>
    <alert kind="noTestClasses" severity="tolerable">
      <title>Aufgabendefinition bezieht sich auf keinen Test</title>
      <stack/>
    </alert>
  </alerts>
</aunit:runResult>

It seems like my backend version requires the /sap/bc/adt/vit/wb/object_type/{type}/object_name/{name}-syntax to be used for packages?

Directly testing classes works fine ./sapcli aunit run class "/ABC/MY_CLASS".

@jfilak
Copy link
Owner

jfilak commented Sep 6, 2019

Oh, this is going to be tough. Do you mind sharing content of /sap/bc/adt/core/discovery (I have no 7.40 for testing)? Hmm, I shall add a command to sapcli.

Could you try changing:
https://github.com/jfilak/sapcli/blob/master/sap/adt/package.py#L39
'packages to vit/wb/object_type/devck/object_name?

@fabianlupa
Copy link
Contributor Author

Oh, this is going to be tough. Do you mind sharing content of /sap/bc/adt/core/discovery (I have no 7.40 for testing)? Hmm, I shall add a command to sapcli.

Sure, I'll send it to you.

Could you try changing:
https://github.com/jfilak/sapcli/blob/master/sap/adt/package.py#L39
'packages to vit/wb/object_type/devck/object_name?

I was looking for that line but my non-existent python knowledge held me back...
I changed it and the request now looks the same except for the additional options-block. However, I still get the same result. Which is very surprising to me. Seems like my assumption was wrong that it was related to the object syntax, sorry.

I also deleted the options block

diff --git a/sap/adt/aunit.py b/sap/adt/aunit.py
index 460eeb5..1bc3cd3 100644
--- a/sap/adt/aunit.py
+++ b/sap/adt/aunit.py
@@ -38,12 +38,6 @@ class AUnit:
   <external>
     <coverage active="false"/>
   </external>
-  <options>
-    <uriType value="semantic"/>
-    <testDeterminationStrategy sameProgram="true" assignedTests="false" appendAssignedTestsPreview="true"/>
-    <testRiskLevels harmless="true" dangerous="true" critical="true"/>
-    <testDurations short="true" medium="true" long="true"/>
-  </options>
   <adtcore:objectSets xmlns:adtcore="http://www.sap.com/adt/core">
     <objectSet kind="inclusive">
       <adtcore:objectReferences>

That didn't change the result either. The requests now look identical to me, except for the upper / lower case of the package name.

./sapcli aunit run package '/ABC/PACKAGE'

<?xml version="1.0" encoding="UTF-8"?>
<aunit:runConfiguration xmlns:aunit="http://www.sap.com/adt/aunit">
  <external>
    <coverage active="false"/>
  </external>
  <adtcore:objectSets xmlns:adtcore="http://www.sap.com/adt/core">
    <objectSet kind="inclusive">
      <adtcore:objectReferences>
        <adtcore:objectReference adtcore:uri="/sap/bc/adt/vit/wb/object_type/devck/object_name/%2Fabc%2Fpackage"/>
      </adtcore:objectReferences>
    </objectSet>
  </adtcore:objectSets>
</aunit:runConfiguration>

ADT

<?xml version="1.0" encoding="UTF-8"?>
<aunit:runConfiguration xmlns:aunit="http://www.sap.com/adt/aunit">
  <external>
    <coverage active="false"/>
  </external>
  <adtcore:objectSets xmlns:adtcore="http://www.sap.com/adt/core">
    <objectSet kind="inclusive">
      <adtcore:objectReferences>
        <adtcore:objectReference adtcore:uri="/sap/bc/adt/vit/wb/object_type/devck/object_name/%2abc%2Fpackage"/>
      </adtcore:objectReferences>
    </objectSet>
  </adtcore:objectSets>
</aunit:runConfiguration>

....even later....

OK, this fixes it, apparently 740SP20 is case sensitive in regards to the package name. The other patch regarding the uri is also needed, deleting the options block is not required.

diff --git a/sap/adt/objects.py b/sap/adt/objects.py
index 1559494..922b6ff 100644
--- a/sap/adt/objects.py
+++ b/sap/adt/objects.py
@@ -413,7 +413,7 @@ class ADTObject(metaclass=OrderedClassMembers):
         """ADT object URL fragment"""

         # pylint: disable=no-member
-        return self.objtype.basepath + '/' + quote_plus(self.name.lower())
+        return self.objtype.basepath + '/' + quote_plus(self.name)

     @property
diff --git a/sap/adt/package.py b/sap/adt/package.py
index 7160d21..548348f 100644
--- a/sap/adt/package.py
+++ b/sap/adt/package.py
@@ -36,7 +36,7 @@ class Package(ADTObject):

     OBJTYPE = ADTObjectType(
         'DEVC/K',
-        'packages',
+        'vit/wb/object_type/devck/object_name',
         xmlns_adtcore_ancestor('pak', 'http://www.sap.com/adt/packages'),
         'application/vnd.sap.adt.packages.v1+xml',
         {},

@jfilak
Copy link
Owner

jfilak commented Sep 6, 2019

Well done! Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants