commit
d64071128e
18
README.md
18
README.md
@ -388,7 +388,7 @@ You can describe the UI way to add new slaves but better to explain how to do in
|
|||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>How would you implement an option of a starting a build from a certain stage and not from the beginning?<summary><br><b>
|
<summary>How would you implement an option of a starting a build from a certain stage and not from the beginning?</summary><br><b>
|
||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
##### Jenkins Dev
|
##### Jenkins Dev
|
||||||
@ -601,13 +601,13 @@ Stop the instance, the type of the instance to match the desired RAM and start t
|
|||||||
<details>
|
<details>
|
||||||
<summary>What is AWS WAF? Give an example of how it can used and describe what resources or services you can use it with</summary><br><b>
|
<summary>What is AWS WAF? Give an example of how it can used and describe what resources or services you can use it with</summary><br><b>
|
||||||
</b></details>
|
</b></details>
|
||||||
|
<details>
|
||||||
<summary>What AWS VPN is usef for?</summary><br><b>
|
<summary>What AWS VPN is used for?</summary><br><b>
|
||||||
</b></details>
|
</b></details>
|
||||||
|
<details>
|
||||||
<summary>What is the difference between Site-to-Site VPN and Client VPN?</summary><br><b>
|
<summary>What is the difference between Site-to-Site VPN and Client VPN?</summary><br><b>
|
||||||
</b></details>
|
</b></details>
|
||||||
|
<details>
|
||||||
<summary>True or False? AWS Inspector can perform both network and host assessments</summary><br><b>
|
<summary>True or False? AWS Inspector can perform both network and host assessments</summary><br><b>
|
||||||
|
|
||||||
True
|
True
|
||||||
@ -1370,7 +1370,7 @@ You can also try closing/terminating the parent process. This will make the zomb
|
|||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Can you explain how network process/connection is established and how it's terminated?><br></b>
|
<summary>Can you explain how network process/connection is established and how it's terminated?></summary><br></b>
|
||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@ -2385,7 +2385,7 @@ Setting the replicas to 0 will shut down the process. Now start it with `kubectl
|
|||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Explain recursion</summary<br><b>
|
<summary>Explain recursion</summary><br><b>
|
||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@ -3303,7 +3303,7 @@ a = f()
|
|||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Can you implement Linked List in Python?<br><b>
|
<summary>Can you implement Linked List in Python?</summary><br><b>
|
||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@ -4147,7 +4147,7 @@ the pseudo table to retrieve the sum of the prices spent by each customer, then
|
|||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summmary>Describe in detail how you bring up an instance with an IP you can reach from outside the cloud</summary><br><b>
|
<summary>Describe in detail how you bring up an instance with an IP you can reach from outside the cloud</summary><br><b>
|
||||||
</b></details>
|
</b></details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
59
scripts/get_answered_questions.py
Normal file
59
scripts/get_answered_questions.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
"""
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
$ python scripts/get_answered_questions.py
|
||||||
|
|
||||||
|
Writes the number of answered questions to STDOUT
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
import pathlib
|
||||||
|
from sys import stdout
|
||||||
|
|
||||||
|
p = pathlib.Path(__file__).parent.parent.joinpath('README.md')
|
||||||
|
|
||||||
|
with open(p, 'rb') as f:
|
||||||
|
file_list = [line.rstrip() for line in f.readlines()]
|
||||||
|
|
||||||
|
|
||||||
|
def get_question_list(file_list) -> list:
|
||||||
|
|
||||||
|
questions_list = []
|
||||||
|
temp = []
|
||||||
|
after_summary_tag = False
|
||||||
|
|
||||||
|
for line in file_list:
|
||||||
|
if line.startswith(b'<details>'):
|
||||||
|
temp.append(line)
|
||||||
|
after_summary_tag = True
|
||||||
|
|
||||||
|
elif after_summary_tag and line != b'' and b'</details>' not in line:
|
||||||
|
temp.append(line)
|
||||||
|
|
||||||
|
elif after_summary_tag and b'</details>' in line:
|
||||||
|
temp.append(line)
|
||||||
|
after_summary_tag = False
|
||||||
|
|
||||||
|
questions_list.append(temp)
|
||||||
|
temp = []
|
||||||
|
|
||||||
|
return questions_list
|
||||||
|
|
||||||
|
|
||||||
|
def get_answered_questions(question_list) -> int:
|
||||||
|
c = 0
|
||||||
|
for q in question_list:
|
||||||
|
index = 0
|
||||||
|
for i in q:
|
||||||
|
if b'</summary>' in i:
|
||||||
|
index = q.index(i)
|
||||||
|
if q[index+1: len(q) - 1]:
|
||||||
|
c += 1
|
||||||
|
return c
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
question_list = get_question_list(file_list)
|
||||||
|
n_answers = get_answered_questions(question_list)
|
||||||
|
stdout.write(str(n_answers))
|
112
tests/syntax_checker.py
Normal file
112
tests/syntax_checker.py
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
"""
|
||||||
|
Testing suite for https://github.com/bregman-arie/devops-interview-questions written by surister
|
||||||
|
|
||||||
|
Even though both check_details_tag and check_summary_tags are practically the same, due to readability and functionality
|
||||||
|
it was decided to be split like that.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
$ python tests/syntax_checker.py
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
p = pathlib.Path(__file__).parent.parent.joinpath('README.md')
|
||||||
|
|
||||||
|
with open(p, 'rb') as f:
|
||||||
|
file_list = [line.rstrip() for line in f.readlines()]
|
||||||
|
|
||||||
|
errors = []
|
||||||
|
|
||||||
|
|
||||||
|
def count_details(file_list):
|
||||||
|
"""
|
||||||
|
Counts the total amount of <details> and </details>
|
||||||
|
|
||||||
|
Used for debugging purpose, not meant to be used in actual tests
|
||||||
|
"""
|
||||||
|
details_final_count = 0
|
||||||
|
details_count = 0
|
||||||
|
|
||||||
|
for line_number, line in enumerate(file_list):
|
||||||
|
if b'<details>' in line:
|
||||||
|
details_count += 1
|
||||||
|
if b'</details>' in line:
|
||||||
|
details_final_count += 1
|
||||||
|
|
||||||
|
return details_count, details_final_count
|
||||||
|
|
||||||
|
|
||||||
|
def check_details_tag(file_list):
|
||||||
|
"""
|
||||||
|
Check whether the structure:
|
||||||
|
<details>
|
||||||
|
...
|
||||||
|
</details>
|
||||||
|
|
||||||
|
Is correctly followed, if not generates an error.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
after_detail = False
|
||||||
|
error = False
|
||||||
|
err_message = ''
|
||||||
|
for line_number, line in enumerate(file_list):
|
||||||
|
if b'<details>' in line and b'</details>' in line:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if b'<details>' in line and after_detail:
|
||||||
|
error = True
|
||||||
|
if b'</details>' in line and not after_detail:
|
||||||
|
err_message = 'Missing opening detail tag'
|
||||||
|
error = True
|
||||||
|
|
||||||
|
if b'<details>' in line:
|
||||||
|
after_detail = True
|
||||||
|
|
||||||
|
if b'</details>' in line and after_detail:
|
||||||
|
err_message = 'Missing closing detail tag'
|
||||||
|
after_detail = False
|
||||||
|
|
||||||
|
if error:
|
||||||
|
raise Exception(f'{err_message} at line {line_number -1}')
|
||||||
|
|
||||||
|
|
||||||
|
def check_summary_tag(file_list):
|
||||||
|
"""
|
||||||
|
Check whether the structure:
|
||||||
|
<summary>
|
||||||
|
...
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
Is correctly followed, if not generates an error.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
after_detail = False
|
||||||
|
error = False
|
||||||
|
err_message = ''
|
||||||
|
for line_number, line in enumerate(file_list):
|
||||||
|
if b'<summary>' in line and b'</summary>' in line:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if b'<summary>' in line and after_detail:
|
||||||
|
error = True
|
||||||
|
if b'</summary>' in line and not after_detail:
|
||||||
|
err_message = 'Missing opening detail tag'
|
||||||
|
error = True
|
||||||
|
|
||||||
|
if b'<summary>' in line:
|
||||||
|
after_detail = True
|
||||||
|
|
||||||
|
if b'</summary>' in line and after_detail:
|
||||||
|
err_message = 'Missing closing detail tag'
|
||||||
|
after_detail = False
|
||||||
|
|
||||||
|
if error:
|
||||||
|
raise Exception(f'{err_message} at line {line_number -3}')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
check_details_tag(file_list)
|
||||||
|
check_summary_tag(file_list)
|
35
tests/syntax_checker_unittest.py
Normal file
35
tests/syntax_checker_unittest.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
"""
|
||||||
|
WIP
|
||||||
|
|
||||||
|
Yes, we do write tests for our tests.
|
||||||
|
"""
|
||||||
|
import unittest
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
from tests import *
|
||||||
|
from scripts import get_answered_questions
|
||||||
|
|
||||||
|
|
||||||
|
def open_test_case_file(n: int):
|
||||||
|
p = pathlib.Path(rf'D:\PycharmProjects\devops-interview-questions\scripts\tests\testcase{n}.md')
|
||||||
|
|
||||||
|
with open(p, 'rb') as f:
|
||||||
|
file_list = [line.rstrip() for line in f.readlines()]
|
||||||
|
return file_list
|
||||||
|
|
||||||
|
|
||||||
|
class QuestionCount(unittest.TestCase):
|
||||||
|
solutions = (
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_count_case_1(self):
|
||||||
|
raw_list = open_test_case_file(1)
|
||||||
|
question_list = get_question_list(raw_list)
|
||||||
|
answers = get_answered_questions.n_answers(question_list)
|
||||||
|
|
||||||
|
self.assertEqual(len(question_list), 21)
|
||||||
|
self.assertEqual(answers, 2)
|
||||||
|
|
||||||
|
def test_count_case_2(self):
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user