• Home
  • Site Aliases
    • www.cloud-native.info
    • oracle.cloud-native.info
    • Phil-Wilkins.uk
  • About
    • Background
    • Presenting Activities
    • Internet Profile
      • LinkedIn
    • About
  • Books & Publications
    • Logging in Action with Fluentd, Kubernetes and More
      • Logging in Action with Fluentd – Book
      • Fluentd Book Resources
      • Log Generator
    • API & API Platform
      • API Useful Resources
    • Oracle Integration
      • Book Website
      • Useful Reading Sources
    • Publication Contributions
  • Resources
    • GitHub
    • Oracle Integration Site
    • Oracle Resources
    • Mindmaps Index
    • Useful Tech Resources
    • Python Setup & related stuff
  • Music
    • Music Reading

Phil (aka MP3Monster)'s Blog

~ from Technology to Music

Phil (aka MP3Monster)'s Blog

Tag Archives: testing

Testing Terraform

26 Tuesday Jul 2022

Posted by mp3monster in Cloud, General, Technology

≈ Leave a comment

Tags

Ansible, automation, Chef, Golang, OCI, SDK, Terraform, Terratest, test, testing

Infrastructure as Code (IaC) should be treated the same way as any other code. That is to say that we should be considering configuration management, testing, regression, code quality, and coverage. We should be addressing these points for the same reasons we address them with our application code. Such as ensuring that we don’t introduce bugs as things evolve and develop, ensuring that the code is maintainable over a prolonged period etc.

The problem is that the only real way to test IaC is to run it. Particularly with the likes of Terraform where it is largely declarative rather than containing a lot of logic. This point is nicely conveyed by Yevgeniy Brikman’s presentation (below)

How to test infrastructure code: automated testing for Terraform, Kubernetes, Docker, Packer and more from Yevgeniy Brikman

The presentation goes on to illustrate Terratest which has the look and feel of JUnit or any other xUnit test framework. Terratest is implemented in Golang, But to be honest, given the nature of Terraform ( largely declarative meaning it enables ideas of composition and not sophisticated logic) it means the writing of the tests isn’t going to demand anything clever like how to achieve polymorphic behavior through Go’s type structures.

While Yevgeniy focussed on testing by invoking an application on the infrastructure deployed something we’ve described though our Platform Test logic (more here). You may wish to test things further by interrogating infrastructure components. For example, do I have the right number of nodes in a dynamic group or are container or server logs going into the cloud monitoring services.

Performing such checks is very easy with OCI as it provides a Golang SDK making it very easy to write tests that can call the OCI APIs and interrogate the setup. Better still when considering whether the Terraform configuration will behave correctly to support dynamic/auto-scaling can be done easily without modifying the Terraform configurations as part of the Terratest logic can include Go API calls to temporarily modify scaling triggers or invoking code that can stimulate OCI dynamic features.

Testing App Configuration

There is an interesting question to be considered. There is a point of separation between when to use Terraform (or Pulumi and others for that matter) and tools better suited to application deployment and configuration like Ansible and Chef. Therefore should we separate the testing of these details? Maybe I am too purist but seeing local and remote execs in Terraform as these actions are very opaque and can be used to conceal things or unwittingly depend on the way Terraform handles its dependency graph.

Of course, Ansible has its test framework ansible_test and has the means to measure test coverage. So one possibility is to treat Ansible as a separate module, independently test it, and then integrate its use in the wider picture of deploying infrastructure.

Share this:

  • Twitter
  • Facebook
  • LinkedIn
  • Print
  • Pocket
  • Email
  • Tumblr
  • Reddit
  • Pinterest
  • WhatsApp
  • Skype

Like this:

Like Loading...

Challenges for the Citizen Integrator

02 Saturday Apr 2016

Posted by mp3monster in General, Oracle, Technology

≈ Leave a comment

Tags

apiary, apiary.io, Boomerang, Citizen Integrator, Cloud, mockable, mockable.io, mocking, OIC - ICS, Oracle, REST, SOAP, SoapUI, testing, WSDL

cloudgs_integrationWe’ve been developing the example integrations to go with book on ICS and have encountered some interesting challenges for the Citizen Integrator (CI) when using an iPaaS (integration Platform as a Service). To say it in non techno speak  someone wanting to plumb system together without needing to be equipped and have the skills of a developer and just using the cloud. One such example is SOAP API testing, before connecting live systems together even a CI will probably want to check that you have mapped the data correctly – important when you’ve potentially got functions and repeating structures in the mapping. To go back to my old analogy that tools for a CI like ICS are the same as Excel to ERP. Then like when creating formulas in a spreadsheet you’re going to plumb in some numbers and check the formula’s results before using in anger.boomerang2b1366

So far so obvious, the fun comes not when you’re wanting to simulate the source event coming into the tool – this can be done through a raft of utilities from Chrome Browser extensions such as Boomerang, soapui_logoSoapUI for example. Things become a lot more challenging when   comes when you want the integration output to go to a mock SOAP API.   The choices available are limited, and pretty much come down to:

  • If you’re lucky you might be able to connect to a test instance of the target service. SalesForce offers a sandbox instance for example to those with a production instance of SalesForce.
  • However sandbox/test instances are less likely for ‘in house’ solutions or products offered as an on premise solution unless there happens to be active development on the solution taking place.screenshot_48
  • Ideally a mocking tool is the route to go – but only 1 option in this space appears to be available for SOAP called mockable.io
  • Other than mockable you’re into using locally installed software and things get messy as it means getting the outbound web traffic routed to your own machine and then use something like MockServer (there is a great article about this tool by my book co-author Robert van Molken here). The chances are unless the network & security manager(s) are good friends or you like messing with your home network it isn’t going to happen.
  • The final option is instantiating an IaaS platform such as Amazon (AWS Free Developer intro scheme to keep your cost down) or perhaps Oracle IaaS, although I’d suggest this is a fairly expensive route to enable the testing of an integration, not to mention the effort to setup things to run the test.

With REST services things are somewhat easier, as there is a lot more tools geared to helping the design of APIs, testing them and critically providing a proxy based framework 65f3fc0eadfae8135439b4ff48f63fd4to enable monetisation. For example Apiary.io can create a test harness for you. Others such as Apigee, also offer such abilities. Apiary offers a trial account and we’ll be hearing a lot more about Apiary in the near future. There is a possible work around, which is to create test integrations that  map the SOAP content into a REST service (Apigee offers such a capability) but with certain constraints you could also do this within ICS itself. But we’ll look at such options within the book (can’t go without to money shot 😀 ).

This of course has only looked at the conventional use of SOAP, if you need to work with a SOAP interface that makes use of the more advanced WS-* extensions such as Reliable Messaging then things come pretty serious, and I’m afraid today you’re going to need to resort to development, and I suspect you’ll not escape that in the future either.

Share this:

  • Twitter
  • Facebook
  • LinkedIn
  • Print
  • Pocket
  • Email
  • Tumblr
  • Reddit
  • Pinterest
  • WhatsApp
  • Skype

Like this:

Like Loading...

Aliases

  • phil-wilkins.uk
  • cloud-native.info
  • oracle.cloud-native.info

I work for Oracle, all opinions here are my own & do not necessarily reflect the views of Oracle

Oracle Ace Director Alumni

TOGAF 9

Logging in Action

Oracle Cloud Integration Book

API Platform Book


Oracle Dev Meetup London

Categories

  • App Ideas
  • Books
    • Book Reviews
    • manning
    • Oracle Press
    • Packt
  • Enterprise architecture
  • General
    • economy
    • LinkedIn
    • Website
  • Music
    • Music Resources
    • Music Reviews
  • Photography
  • Podcasts
  • Technology
    • APIs & microservices
    • chatbots
    • Cloud
    • Cloud Native
    • Dev Meetup
    • development
      • languages
        • node.js
    • drone
    • Fluentd
    • logsimulator
    • mindmap
    • OMESA
    • Oracle
      • API Platform CS
        • tools
      • Helidon
      • ITSO & OEAF
      • Java Cloud
      • NodeJS Cloud
      • OIC – ICS
      • Oracle Cloud Native
      • OUG
    • railroad diagrams
    • TOGAF
  • xxRetired

My Other Web Content & Contributions

  • Amazon Author entry
  • API Platform
  • Dev Meetup (co-managed)
  • Fluentd Book
  • ICS Book Website
  • OMESA
  • Ora World
  • Oracle Community Directory
  • Packt Author Bio
  • Phil on Blogs.Oracle.com
  • Sessionize Profile

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2,574 other subscribers

RSS

RSS Feed RSS - Posts

RSS Feed RSS - Comments

April 2023
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
« Mar    

Twitter

  • Get all the details about the new enhancements to @Oracle Container Engine for Kubernetes, including Serverless… twitter.com/i/web/status/1…Next Tweet: 3 days ago
  • RT @TechWeekRO: With over 25 years of experience in the software industry, Phil Wilkins, Cloud Developer Evangelist at @Oracle, is coming t…Next Tweet: 3 days ago
  • SSH Key File Permissions blog.mp3monster.org/2023/03/28/ssh…Next Tweet: 4 days ago
  • Oracle's Assurance Service gives customers the proactive guidance they need to move their organization forward whil… twitter.com/i/web/status/1…Next Tweet: 4 days ago
  • Fraud affects many businesses and can be costly. But there’s a way to fight it. Scalable Machine Learning algorithm… twitter.com/i/web/status/1…Next Tweet: 4 days ago
Follow @mp3monster

History

Speaker Recognition

Open Source Summit Speaker

Flickr Pics

Pembroke CastleSeven Bridge Crossing
More Photos

    Social

    • View @mp3monster’s profile on Twitter
    • View philwilkins’s profile on LinkedIn
    • View mp3monster’s profile on GitHub
    • View mp3monster’s profile on Flickr
    • View philmp3monster’s profile on Twitch
    Follow Phil (aka MP3Monster)'s Blog on WordPress.com

    Blog at WordPress.com.

    • Follow Following
      • Phil (aka MP3Monster)'s Blog
      • Join 218 other followers
      • Already have a WordPress.com account? Log in now.
      • Phil (aka MP3Monster)'s Blog
      • Customize
      • Follow Following
      • Sign up
      • Log in
      • Report this content
      • View site in Reader
      • Manage subscriptions
      • Collapse this bar
     

    Loading Comments...
     

    You must be logged in to post a comment.

      Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
      To find out more, including how to control cookies, see here: Our Cookie Policy
      %d bloggers like this: