{"id":1794,"date":"2021-11-26T06:07:36","date_gmt":"2021-11-26T06:07:36","guid":{"rendered":"https:\/\/blog.samarthya.me\/wps\/?p=1794"},"modified":"2021-11-26T06:07:39","modified_gmt":"2021-11-26T06:07:39","slug":"helm-test","status":"publish","type":"post","link":"https:\/\/blog.samarthya.me\/wps\/2021\/11\/26\/helm-test\/","title":{"rendered":"Helm Test"},"content":{"rendered":"\n<p>The only advice I can give to folks who are building helm charts from scratch, is always keep it incremental and do not try to do everything at one go. At least build a decent few before you even try to attempt such a thing, else you will only end up WASTING your precious time on trivial issues which could have been avoided by incremental build, rather than the big bang approach.<\/p>\n\n\n\n<p>All right, back to the topic. In this blog I will build a helm test pod for validating the deployed helm chart and ensuring things work fine. I will continue to improve it in iterations but may be not all in the same blog! \ud83d\ude09<\/p>\n\n\n\n<p>The <code>helm test &lt;release-name><\/code> will publish the following results.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@master> helm test demo -n demo --logs\n\nPod demo-odc-test-connection pending\nPod demo-odc-test-connection pending\nPod demo-odc-test-connection pending\nPod demo-odc-test-connection pending\nPod demo-odc-test-connection running\nPod demo-odc-test-connection succeeded\nNAME: demo\nLAST DEPLOYED: Thu Nov 25 15:00:00 2021\nNAMESPACE: demo\nSTATUS: deployed\nREVISION: 6\nTEST SUITE:     demo-odc-test-connection\nLast Started:   Fri Nov 26 05:23:59 2021\nLast Completed: Fri Nov 26 05:24:06 2021\nPhase:          Succeeded\nNOTES:\n1. Get the application URL by running these commands:\n  https:&#47;&#47;restmon.com\/\n\nPOD LOGS: demo-odc-test-connection\nnewman\n\nRestmon\n\n\u2192 VersionTest\n  GET https:\/\/demo-odc:9090\/restmon\/api\/v1\/version &#91;200 OK, 527B, 231ms]\n  \u2713  Status code is 200\n  \u2713  Body matches string\n\n\u2192 SchemaTest\n  GET https:\/\/demo-odc:9090\/restmon\/api\/v1\/schema\/getAllSchemaName &#91;200 OK, 2.48kB, 40ms]\n  \u2713  Status code is 200\n  \u2713  Check the number of schemas read\n\n\u2192 ProfileTest\n  GET https:\/\/demo-odc:9090\/restmon\/api\/v1\/profiles &#91;200 OK, 413B, 13ms]\n  \u2713  Status code is 200\n  \u250c\n  \u2502 '> ', {}\n  \u2514\n  \u2713  Empty Response\n\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502                         \u2502          executed \u2502            failed \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502              iterations \u2502                 1 \u2502                 0 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502                requests \u2502                 3 \u2502                 0 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502            test-scripts \u2502                 6 \u2502                 0 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502      prerequest-scripts \u2502                 4 \u2502                 0 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502              assertions \u2502                 6 \u2502                 0 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 total run duration: 443ms                                       \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 total data received: 2.1kB (approx)                             \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 average response time: 94ms &#91;min: 13ms, max: 231ms, s.d.: 97ms] \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n\n<\/code><\/pre>\n\n\n\n<p>Few pointers about a HELM chart<\/p>\n\n\n\n<figure class=\"wp-block-pullquote\"><blockquote><p>A\u00a0<strong>test<\/strong>\u00a0in a helm chart lives under the\u00a0<code>templates\/<\/code>\u00a0directory and is a job definition that specifies a container with a given command to run. \u00a0<\/p><cite>https:\/\/helm.sh\/<\/cite><\/blockquote><\/figure>\n\n\n\n<figure class=\"wp-block-pullquote is-style-default\" style=\"border-color:#000000\"><blockquote class=\"has-text-color has-black-color\"><p><em>The container should exit successfully (exit 0) for a test to be considered a success.<\/em><\/p><cite>helm.sh<\/cite><\/blockquote><\/figure>\n\n\n\n<p>In this blog, I am writing test case for my helm chart which employs a config-map, secret, pod, service and ingress &amp; that leaves loads of scope of incremental add-ons.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step &#8211; 1: Checking the exposes end points are accessible<\/h2>\n\n\n\n<p>To check end points we will use a postman to create suite to define the URL&#8217;s to invoke along with the arguments and test cases to validate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create New Collection: Restmon<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"494\" height=\"591\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image.png\" alt=\"\" class=\"wp-image-1795\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image.png 494w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-251x300.png 251w\" sizes=\"(max-width: 494px) 100vw, 494px\" \/><figcaption>1. Create a collection<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Name Restmon: Basic Auth<\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"680\" height=\"570\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-1.png\" alt=\"\" class=\"wp-image-1796\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-1.png 680w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-1-300x251.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-1-300x251@2x.png 600w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><figcaption>Basic-auth credentials<\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Add variables: Host, Protocol, Port<\/h3>\n\n\n\n<p>Since the endpoint can be hosted on any host on any port &amp; over HTTP or HTTPS, I will introduce variables that can be customised.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"938\" height=\"379\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-2.png\" alt=\"\" class=\"wp-image-1797\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-2.png 938w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-2-300x121.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-2-768x310.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-2-300x121@2x.png 600w\" sizes=\"(max-width: 938px) 100vw, 938px\" \/><figcaption>Variables<\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Add pre-request script<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"967\" height=\"183\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-4.png\" alt=\"\" class=\"wp-image-1801\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-4.png 967w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-4-300x57.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-4-768x145.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-4-300x57@2x.png 600w\" sizes=\"(max-width: 967px) 100vw, 967px\" \/><figcaption>pm.request.url<\/figcaption><\/figure>\n\n\n\n<p>It uses the three variables defined in the previous step to create the request URL which will be used in the subsequent requests.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Click <code>Add Request<\/code> <\/h2>\n\n\n\n<p>Click Add request from the collection <code>Restmon<\/code> three dots menu on the left.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"246\" height=\"685\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-3.png\" alt=\"\" class=\"wp-image-1800\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-3.png 246w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-3-108x300.png 108w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-3-108x300@2x.png 216w\" sizes=\"(max-width: 246px) 100vw, 246px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Validate Version: VersionTest Request<\/h3>\n\n\n\n<p>The request is a <code>GET<\/code> and will use the <code>pm.request.url<\/code> which was defined at the collection level.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"358\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-5-1024x358.png\" alt=\"\" class=\"wp-image-1802\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-5-1024x358.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-5-300x105.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-5-768x269.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-5.png 1092w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-5-300x105@2x.png 600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>The UI is very intuitive and you can simply explore options on which test might be applicable for your tests. In my case I am just checking the version information.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"818\" height=\"464\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-6.png\" alt=\"\" class=\"wp-image-1805\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-6.png 818w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-6-300x170.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-6-768x436.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-6-300x170@2x.png 600w\" sizes=\"(max-width: 818px) 100vw, 818px\" \/><figcaption>Test cases<\/figcaption><\/figure><\/div>\n\n\n\n<p>The test cases added check for Status code and the response string. You can do a quick check for the test by pressing the <code>Send<\/code> Button.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"91\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-7-1024x91.png\" alt=\"\" class=\"wp-image-1806\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-7-1024x91.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-7-300x27.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-7-768x69.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-7.png 1390w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-7-300x27@2x.png 600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>Check the results in the bottom window.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"170\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-8-1024x170.png\" alt=\"\" class=\"wp-image-1807\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-8-1024x170.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-8-300x50.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-8-768x128.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-8.png 1373w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-8-300x50@2x.png 600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>Similarly I have few other API&#8217;s that I will quickly add to the collection<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"876\" height=\"443\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-9.png\" alt=\"\" class=\"wp-image-1808\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-9.png 876w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-9-300x152.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-9-768x388.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-9-300x152@2x.png 600w\" sizes=\"(max-width: 876px) 100vw, 876px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"728\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-10-1024x728.png\" alt=\"\" class=\"wp-image-1809\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-10-1024x728.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-10-300x213.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-10-768x546.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-10.png 1058w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-10-300x213@2x.png 600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>Once the collection is saved you can run the collection by selecting <code>Run collection<\/code> from the three dots menu on the left.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"420\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-11-1024x420.png\" alt=\"\" class=\"wp-image-1810\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-11-1024x420.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-11-300x123.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-11-768x315.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-11.png 1332w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-11-300x123@2x.png 600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>Check the response before we export it by clicking <code>Export<\/code> option in the three dots menu in collection.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"441\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-12-1024x441.png\" alt=\"\" class=\"wp-image-1811\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-12-1024x441.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-12-300x129.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-12-768x331.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-12.png 1452w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-12-300x129@2x.png 600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"573\" height=\"338\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-13.png\" alt=\"\" class=\"wp-image-1812\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-13.png 573w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-13-300x177.png 300w\" sizes=\"(max-width: 573px) 100vw, 573px\" \/><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-pullquote has-background has-luminous-vivid-orange-background-color is-style-solid-color\"><blockquote class=\"has-text-color has-white-color\"><p>My Project space is a maven project space so the chart is in the src\/ folder. Which is critical because when you package chart you have to be careful where the file lies?<\/p><\/blockquote><\/figure>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"503\" height=\"276\" src=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-14.png\" alt=\"\" class=\"wp-image-1815\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-14.png 503w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2021\/11\/image-14-300x165.png 300w\" sizes=\"(max-width: 503px) 100vw, 503px\" \/><figcaption>restmon.json<\/figcaption><\/figure><\/div>\n\n\n\n<p>So in the <code>src\/<\/code> folder I push my <code>restmon.json<\/code> (Project space of my chart restmon)<\/p>\n\n\n\n<p>I will run this project space using <code>newman<\/code> which is the console runner for postman projects.<\/p>\n\n\n\n<figure class=\"wp-block-pullquote has-background is-style-solid-color\" style=\"background-color:#0693e3\"><blockquote class=\"has-text-color has-white-color\"><p>Newman is a command-line collection runner for Postman. It allows you to effortlessly run and test a Postman collection directly from the command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.<\/p><cite>NPM<\/cite><\/blockquote><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow\"><p>Refer to the official documentation here.<\/p><cite>helm.sh<\/cite><\/blockquote>\n\n\n\n<p>Time to create the test case. Notice the volumes which loads a config map also given below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\r\nkind: ConfigMap\r\nmetadata:\r\n  name: postman-cmd\r\n  namespace: {{ .Release.Namespace }}\r\ndata:\r\n  restmon.json: |-\r\n  {{ .Files.Get \"restmon.json\" | nindent 4 }}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\r\nkind: Pod\r\nmetadata:\r\n  namespace: {{ .Release.Namespace }}\r\n  name: \"{{ include \"odc.fullname\" . }}-test-connection\"\r\n  labels:\r\n    {{- include \"odc.labels\" . | nindent 4 }}\r\n  annotations:\r\n    \"helm.sh\/hook\": test\r\nspec:\r\n  containers:\r\n    - name: post-test\r\n      image: postman\/newman:latest\r\n      volumeMounts:\r\n        - mountPath: \/etc\/newman\/restmon.json\r\n          name: configv\r\n          subPath: restmon.json\r\n      args:\r\n        - \"run\"\r\n        - restmon.json\r\n        - --env-var\r\n        - HOSTNAME={{ include \"odc.fullname\" . }}\r\n        - --env-var\r\n        - PORT={{ include \"odc.serviceport\" . }}\r\n        - --env-var\r\n        {{- if .Values.ingress.tls }}\r\n        - PROTOCOL=https\r\n        {{- else }}\r\n        - --env-var\r\n        - PROTOCOL=http\r\n        {{ end }}\r\n  volumes:\r\n    - name: configv\r\n      configMap:\r\n        name: postman-cmd\r\n  restartPolicy: Never<\/code><\/pre>\n\n\n\n<p>The Test case will try and execute the postman project using the newman image<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>newman run --help\n\r\nUsage: newman run &lt;collection> &#91;options]\r\n\r\nInitiate a Postman Collection run from a given URL or path\r\n\r\nOptions:\r\n  -e, --environment &lt;path>              Specify a URL or path to a Postman Environment\r\n  -g, --globals &lt;path>                  Specify a URL or path to a file containing Postman Globals\r\n  -r, --reporters &#91;reporters]           Specify the reporters to use for this run (default: &#91;\"cli\"])\r\n  -n, --iteration-count &lt;n>             Define the number of iterations to run\r\n  -d, --iteration-data &lt;path>           Specify a data file to use for iterations (either JSON or CSV)\r\n  --folder &lt;path>                       Specify the folder to run from a collection. Can be specified multiple times to\r\n                                        run multiple folders (default: &#91;])\r\n  --global-var &lt;value>                  Allows the specification of global variables via the command line, in a\r\n                                        key=value format (default: &#91;])\r\n  --env-var &lt;value>                     Allows the specification of environment variables via the command line, in a\r\n                                        key=value format (default: &#91;])\r\n  --export-environment &lt;path>           Exports the final environment to a file after completing the run\r\n  --export-globals &lt;path>               Exports the final globals to a file after completing the run\r\n  --export-collection &lt;path>            Exports the executed collection to a file after completing the run\r\n  --postman-api-key &lt;apiKey>            API Key used to load the resources from the Postman API\r\n  --bail &#91;modifiers]                    Specify whether or not to gracefully stop a collection run on encountering an\r\n                                        error and whether to end the run with an error based on the optional modifier\r\n  --ignore-redirects                    Prevents Newman from automatically following 3XX redirect responses\r\n  -x , --suppress-exit-code             Specify whether or not to override the default exit code for the current run\r\n  --silent                              Prevents Newman from showing output to CLI\r\n  --disable-unicode                     Forces Unicode compliant symbols to be replaced by their plain text equivalents\r\n  --color &lt;value>                       Enable\/Disable colored output (auto|on|off) (default: \"auto\")\r\n  --delay-request &#91;n]                   Specify the extent of delay between requests (milliseconds) (default: 0)\r\n  --timeout &#91;n]                         Specify a timeout for collection run (milliseconds) (default: 0)\r\n  --timeout-request &#91;n]                 Specify a timeout for requests (milliseconds) (default: 0)\r\n  --timeout-script &#91;n]                  Specify a timeout for scripts (milliseconds) (default: 0)\r\n  --working-dir &lt;path>                  Specify the path to the working directory\r\n  --no-insecure-file-read               Prevents reading the files situated outside of the working directory\r\n  -k, --insecure                        Disables SSL validations\r\n  --ssl-client-cert-list &lt;path>         Specify the path to a client certificates configurations (JSON)\r\n  --ssl-client-cert &lt;path>              Specify the path to a client certificate (PEM)\r\n  --ssl-client-key &lt;path>               Specify the path to a client certificate private key\r\n  --ssl-client-passphrase &lt;passphrase>  Specify the client certificate passphrase (for protected key)\r\n  --ssl-extra-ca-certs &lt;path>           Specify additionally trusted CA certificates (PEM)\r\n  --cookie-jar &lt;path>                   Specify the path to a custom cookie jar (serialized tough-cookie JSON)\r\n  --export-cookie-jar &lt;path>            Exports the cookie jar to a file after completing the run\r\n  --verbose                             Show detailed information of collection run and each request sent\r\n  -h, --help                            display help for command<\/code><\/pre>\n\n\n\n<p>Your test is ready, let&#8217;s try it.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Deploy the chart <code>helm install demo .\/restmon.tgz -n demo<\/code><\/li><li>Run the helm test <code>helm test demo -n demo<\/code><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>helm test demo -n demo --logs\n\r\nPod demo-odc-test-connection pending\r\nPod demo-odc-test-connection pending\r\nPod demo-odc-test-connection pending\r\nPod demo-odc-test-connection pending\r\nPod demo-odc-test-connection running\r\nPod demo-odc-test-connection succeeded\r\nNAME: demo\nLAST DEPLOYED: Thu Nov 25 15:00:00 2021\r\nNAMESPACE: demo\nSTATUS: deployed\r\nREVISION: 6\r\nTEST SUITE:     demo-odc-test-connection\r\nLast Started:   Fri Nov 26 05:23:59 2021\r\nLast Completed: Fri Nov 26 05:24:06 2021\r\nPhase:          Succeeded\r\nNOTES:\r\n1. Get the application URL by running these commands:\r\n  https:&#47;&#47;restmon.com\/\r\n\r\nPOD LOGS: demo-odc-test-connection\r\nnewman\r\n\r\nRestmon\r\n\r\n\u2192 VersionTest\r\n  GET https:\/\/demo-odc:9090\/restmon\/api\/v1\/version &#91;200 OK, 527B, 231ms]\r\n  \u2713  Status code is 200\r\n  \u2713  Body matches string\r\n\r\n\u2192 SchemaTest\r\n  GET https:\/\/demo-odc:9090\/restmon\/api\/v1\/schema\/getAllSchemaName &#91;200 OK, 2.48kB, 40ms]\r\n  \u2713  Status code is 200\r\n  \u2713  Check the number of schemas read\r\n\r\n\u2192 ProfileTest\r\n  GET https:\/\/demo-odc:9090\/restmon\/api\/v1\/profiles &#91;200 OK, 413B, 13ms]\r\n  \u2713  Status code is 200\r\n  \u250c\r\n  \u2502 '> ', {}\r\n  \u2514\r\n  \u2713  Empty Response\r\n\r\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502                         \u2502          executed \u2502            failed \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502              iterations \u2502                 1 \u2502                 0 \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502                requests \u2502                 3 \u2502                 0 \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502            test-scripts \u2502                 6 \u2502                 0 \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502      prerequest-scripts \u2502                 4 \u2502                 0 \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502              assertions \u2502                 6 \u2502                 0 \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502 total run duration: 443ms                                       \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502 total data received: 2.1kB (approx)                             \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502 average response time: 94ms &#91;min: 13ms, max: 231ms, s.d.: 97ms] \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The only advice I can give to folks who are building helm charts from scratch, is always keep it incremental and do not try to do everything at one go. At least build a decent few before you even try to attempt such a thing, else you will only end up WASTING your precious time [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1812,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[34],"tags":[202,204,205,96,203],"class_list":["post-1794","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-technical","tag-helmv3","tag-newman","tag-postman","tag-service","tag-test","post_format-post-format-image"],"_links":{"self":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/1794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/comments?post=1794"}],"version-history":[{"count":0,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/1794\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media\/1812"}],"wp:attachment":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media?parent=1794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/categories?post=1794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/tags?post=1794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}