def test_012_yaml_load(self): """ tests adding jobs from a YAML file :return: """ HEADING() db = self.db db.connect() # Clear all jobs currently in the database to ensure a correct final assertion db.clear() # Add the jobs outlined in the YAML file db.add_from_yaml("etc/jobs.yaml") count_fgrep = len(Shell.fgrep("input:", "etc/jobs.yaml").split("\n")) # Assert that the correct number jobs have been added assert (db.count() == count_fgrep)
def test_012_yaml_load(self): """ tests adding jobs from a YAML file :return: """ HEADING() db = self.db db.connect() # Clear all jobs currently in the database to ensure a correct final assertion db.clear() # Add the jobs outlined in the YAML file db.add_from_yaml("etc/jobs.yaml") count_fgrep = len(Shell.fgrep("input:", "etc/jobs.yaml").split("\n")) # Assert that the correct number jobs have been added assert(db.count() == count_fgrep)
def test_013_find_files(self): """ tests searching for a file the file being searched for exists in 3 files: twice as input and twice as output :return: """ HEADING() db = self.db db.connect() # Clear all jobs currently in the database to ensure a correct final assertion db.clear() # Add the jobs outlined in the YAML file db.add_from_yaml("etc/jobs.yaml") inputs, outputs = db.find_jobs_with_file("in1.txt") # Assert that the lengths of the inputs and outputs arrays are correct count_fgrep = len(Shell.fgrep("in1.txt", "etc/jobs.yaml").strip().split("\n")) assert(len(inputs) == count_fgrep)
def test_013_find_files(self): """ tests searching for a file the file being searched for exists in 3 files: twice as input and twice as output :return: """ HEADING() db = self.db db.connect() # Clear all jobs currently in the database to ensure a correct final assertion db.clear() # Add the jobs outlined in the YAML file db.add_from_yaml("etc/jobs.yaml") inputs, outputs = db.find_jobs_with_file("in1.txt") # Assert that the lengths of the inputs and outputs arrays are correct count_fgrep = len( Shell.fgrep("in1.txt", "etc/jobs.yaml").strip().split("\n")) assert (len(inputs) == count_fgrep)
def ps(self): r = Shell.fgrep(Shell.ps("aux", _tty_out=False), "mongod", _tty_in=False) print(r)