ACE unit tests running against your code

ACE unit tests running against your code

In my last post I demonstrated how to run some ACE based unit tests inside a custom container that we created.?

Our container was based on an IBM Docker image with some extra components to make test coverage easier.

As covered in my last post, we have 2 ways to support test coverage for ACE/IIB/WMB.

Tracing - where we consume the trace file and convert it to a code coverage report.

Instrumentation - where we add instrumentation/profile points to running code to capture events around what has been executed. We then save that as a code coverage report.

In both cases we send the code analyzed and coverage report to SonarQube to generate a coverage dashboard (and all the issues and other metrics).

So we can demonstrate how this works when we run the container.

But this is really only useful as a demonstration tool. Not something that will help anyone to develop Ci/Cd processes.

So the next step is be able to demonstrate this process running with some one else's code. So not the pre-packaged demonstration project but some real code that comes from a version control system and is assembled using a real process.

There are a few platforms for Ci/Cd out there on the cloud. I have been doing some other work with GitHub, so I started to look into developing a GitHub action.

After a bit of reading on how to write an action, I started developing one with a Docker image based action.?

The other option is write a type script based action, but that installs the necessary software on the GitHub launched VM, which wouldn't provide that isolation that a container provides.

The ACE image is based on Redhat and some IBM components. My initial attempts to turn the Docker image into an action were un-successful.

The next option was to run a Docker image via a GitHub workflow.

So, the first step was to push the image to somewhere that will be publicly available. We published it to DockerHub here.

There were a few options, but DockerHub is popular and doesn't need a login / credential for most pulls.

I found a good example for running steps in a container:

https://github.com/richardh65/bct-ace-ant-action

I didn't end up needing to change the Docker file:

https://gitlab.com/richardh65/bct-public-code/-/blob/master/docker-examples/Dockerfile

And then it was just a matter of replicating what was in the startup.sh file.

In the workflow steps:

https://github.com/richardh65/bct-ace-ant-action/blob/main/.github/workflows/trace.yml

Pass the license acceptance flag:

--env LICENSE=accept        

Mount the default checkout directory into the container ${{github.workspace}}:

-v ${{ github.workspace }}:/tmp/work/other/code        

And make sure we set the working directory:

-w /tmp/work/other/code        

Which matches the paths in the checked out code and the paths in the ANT script.


<exec dir="/opt/ibm/ace-12/server/bin" executable="mqsipackagebar" failonerror="true" > ? ?
    <arg value="-w"/>
? ? <arg value="/tmp/work/other/code"/>
? ? <arg value="-a"/>
? ? <arg value="/tmp/work/other/code/BarFiles/UnitTests.bar"/> ? ? ? ? ?
? ? <arg value="-t"/>
? ? <arg value="TestSimple_Project_Test"/>
? ? <arg value="-k"/>
? ? <arg value="TestSimple_Project"/>? ? ? ? ? 
</exec>


<exec dir="/opt/ibm/ace-12/server/bin" executable="mqsicreateworkdir" failonerror="true" > ? ?
? ? ? ? <arg value="/tmp/work/other/code/test_work_dir"/>
? ? 
? ? </exec>

<copy file="/tmp/work/other/code/config/server.conf.yaml" 
? ? ? ? ? ? todir="/tmp/work/other/code/test_work_dir" force="true" failonerror="true" />
 

<exec executable="IntegrationServer" dir="/opt/ibm/ace-12/server/bin" failonerror="true" > ? ?
   <arg value="--default-application-name"/>
 ? <arg value="TestSimple_Project_UnitTestsApp"/>? ? ? ? ? ? ? 
 ? <arg value="--console-log"/> ? ? ? ? ? ? ? ?
 ? <arg value="--work-dir"/>
 ? <arg value="/tmp/work/other/code/test_work_dir"/>
 ? <arg value="--test-project"/>
 ? <arg value="TestSimple_Project_Test"/>
 ? <arg value="--start-msgflows"/>
 ? <arg value="false"/> ? ? ? ? ? ? 
 ? <arg value="--stop-after-duration"/>
 ? <arg value="60000" />? ? ? ? ? ? ? ? 
</exec>
         


Then run the steps:

- name: Run the build process with Docker
? uses: addnab/docker-run-action@v3
? with:
?   image: richardh65/bct-tools:latest
? ? options: --env LICENSE=accept -v ${{ github.workspace }}:/tmp/work/other/code -w /tmp/work/other/code
? ? run: |
       /usr/local/ant/apache-ant-1.10.12/bin/ant -f trace_build.xml
       ls -la /tmp/work/other/code/coveragetemp
       /usr/local/sonar-scanner/sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner -Dproject.settings=./sonar-project-tracing.properties
        


Again, this will send the coverage reports to our demonstration SonarQube instance, and are available here:

https://172.105.183.5:9000


We are doing a quick walkthrough later on in the week for anyone who is interested or has any questions. You can register here:

Thursday 10:00 pm Brisbane time.

If anyone is interested in a demonstration or has any questions, thoughts or wants to try it internally please reach out to me either on LinkedIn or via our website:

https://bettercodingtools.com


You can also reach me via email at:

[email protected]


Or contact me via the contact page on our website:

www.bettercodingtools.com/contact


Regards

Richard

要查看或添加评论,请登录

Richard Huegill的更多文章

  • Opaque parsing and performance

    Opaque parsing and performance

    A while back I was asked what our tooling could do to help improve performance for ACE/IIB code. Whether that means…

    2 条评论
  • Embedding DrawIO IIB/WMB/ACE flow diagrams in Confluence

    Embedding DrawIO IIB/WMB/ACE flow diagrams in Confluence

    Happy New Year My last demonstration was all the way back in time, 2024, almost 3 months and 4 hangovers ago. Or 3…

  • Apologies for the broken webinar

    Apologies for the broken webinar

    So last week we attempted to do a webinar on creating Confluence pages to summarize WMB/IIB/ACE code. Unfortunately…

  • Something I don't know too much about

    Something I don't know too much about

    It's ACE and Java classLoader's (but I'm sure friends will be able to point out many others). Actually this is only…

  • Confluence page generation for IIB/WMB/ACE applications

    Confluence page generation for IIB/WMB/ACE applications

    The larger an organization becomes, the more challenging that it is for an organization to manage is combined knowledge…

    2 条评论
  • WMB / IIB / ACE GitLab pages (with sound this time)

    WMB / IIB / ACE GitLab pages (with sound this time)

    The recent version 17 release of GitLab has added GitLab pages. Last week we did a live demo on using GitLab Pages to…

    2 条评论
  • GitLab Pages and IIB

    GitLab Pages and IIB

    The recent version 17 release of GitLab has added some enhancements and fixed some issues. On the of the newer features…

  • SonarQube 10.6 released

    SonarQube 10.6 released

    SonarSource recently a new version of their Sonarqube platform - SonarQube 10.6 For us, we have to update some of build…

  • Squid's (not the game)

    Squid's (not the game)

    When I develop code, I have never gotten it write first time. This is compounded when you work integration tooling.

  • Information radiators for IIB/ACE/WMB projects managed in GitLab

    Information radiators for IIB/ACE/WMB projects managed in GitLab

    Some of the functionality that we have in our plugin is more the "art" side of software engineering then the hard…

社区洞察

其他会员也浏览了