Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output differences for bgp configurations #2768

Merged
merged 1 commit into from
Apr 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/sonic-config-engine/tests/test_j2files.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def run_script(self, argument):
print 'CMD: sonic-cfggen ' + argument
return subprocess.check_output(self.script_file + ' ' + argument, shell=True)

def run_diff(self, file1, file2, diff):
return subprocess.check_output('diff {} {} >{}'.format(file1, file2, diff), shell=True)
def run_diff(self, file1, file2):
return subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True)

def test_interfaces(self):
interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2')
Expand Down Expand Up @@ -61,7 +61,10 @@ def test_bgpd_quagga(self):
conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'bgpd.conf.j2')
argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file
self.run_script(argument)
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'bgpd_quagga.conf'), self.output_file))
original_filename = os.path.join(self.test_dir, 'sample_output', 'bgpd_quagga.conf')
r = filecmp.cmp(original_filename, self.output_file)
diff_output = self.run_diff(original_filename, self.output_file) if not r else ""
self.assertTrue(r, "Diff:\n" + diff_output)

def test_zebra_quagga(self):
conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'zebra.conf.j2')
Expand Down