1
00:00:00,000 --> 00:00:07,833
Hi, Let's understand about Lint and Test.

2
00:00:07,833 --> 00:00:13,166
Till now, we have seen how to create the template and deploy the template into the cluster

3
00:00:13,166 --> 00:00:17,532
And there are n number of stages where we need to do the testing

4
00:00:17,533 --> 00:00:23,266
For example, immediately after making the templates or creating the templates, I need to do the testing,

5
00:00:23,266 --> 00:00:26,266
whether it is adhering to the standard or not.

6
00:00:26,266 --> 00:00:30,866
as well as after the entities are deployed into the kubernetes cluster we need to verify whether

7
00:00:30,866 --> 00:00:34,032
the deployment happened properly, as expected or not.

8
00:00:34,033 --> 00:00:39,533
For that, we need to do some testing. For that helm provide two options one is lint

9
00:00:39,533 --> 00:00:43,699
where it can verify the template whether it is adhering to the standard or not.

10
00:00:43,700 --> 00:00:48,733
This is like lint option available in any other language and the command is very simple.

11
00:00:48,733 --> 00:00:54,499
All I need to do is invoke Helm lint and then the chart folder location.

12
00:00:54,500 --> 00:00:57,033
For example, I do have n number of charts.

13
00:00:57,033 --> 00:01:00,833
Let me go ahead and run lint.

14
00:01:00,833 --> 00:01:05,599
helm lint and then the chart source.

15
00:01:05,600 --> 00:01:11,733
So that's going to get into the charts and verify whether it is adhering to the standard or not.

16
00:01:11,733 --> 00:01:16,799
In this particular case it provided only one one info where icon is recommended for chart.yaml

17
00:01:16,800 --> 00:01:19,900
file. Other than that there are no error messages.

18
00:01:19,900 --> 00:01:26,100
In case, if I wanted to verify how it's going to give the error messages, I can inject the error.

19
00:01:26,100 --> 00:01:30,833
Let me get into the charts, modify the template.

20
00:01:30,833 --> 00:01:35,799
Let me go ahead and change the template for test purpose.

21
00:01:35,800 --> 00:01:40,966
For example here I'm going to add a dash.

22
00:01:40,966 --> 00:01:43,866
So that it will become an invalid yaml file.

23
00:01:43,866 --> 00:01:47,099
And in the early lecture, we discussed about what this particular dash going to do.

24
00:01:47,100 --> 00:01:52,033
It's going to remove the new line and append this particular content as a part of the labels.

25
00:01:52,033 --> 00:01:58,766
And this will fail to validate to be a valid yaml file. After making the changes

26
00:01:58,766 --> 00:02:02,132
Let me go ahead and run the lint command.

27
00:02:02,133 --> 00:02:08,633
And it identified the error as it's not able to convert the yaml file because it's not a valid yaml file.

28
00:02:08,633 --> 00:02:12,466
And what the value that we had provided is not a valid one.

29
00:02:12,466 --> 00:02:14,866
And this will help us in a big way

30
00:02:14,866 --> 00:02:18,666
while doing the development or constructing the templates.

31
00:02:18,666 --> 00:02:21,232
Let me go ahead and correct the same.

32
00:02:21,233 --> 00:02:26,499
And since it's going to provide the warning message of front, we should be in a position to correct

33
00:02:26,500 --> 00:02:33,900
and get the valid yaml file as a part of the templates and able to get a valid yaml file.

34
00:02:33,900 --> 00:02:37,333
I'm correcting making it as a valid yaml file.

35
00:02:37,333 --> 00:02:41,933
Now I can go ahead and run the lint command.

36
00:02:41,933 --> 00:02:47,899
And this lint can be integrated with other CICD tools, so that the lint run can be automated

37
00:02:47,900 --> 00:02:53,100
and whenever it is getting a new source as a part of GitHub repository or even into

38
00:02:53,100 --> 00:02:54,933
the source control system automatically

39
00:02:54,933 --> 00:03:01,099
This lint can get invoked and validate whether the valid templates are getting checked into the

40
00:03:01,100 --> 00:03:04,500
repository or the source control system.

41
00:03:04,500 --> 00:03:08,766
And there is another option to test whether the entities are deployed properly or not.

42
00:03:08,766 --> 00:03:13,832
That will be achieved using test that we will be seeing it in the next lecture.

43
00:03:13,833 --> 00:03:18,799
So in a quick summary we have seen how to use the lint and how it's going to give the error messages

44
00:03:18,800 --> 00:03:21,766
after validating the templates and the charts.

