Closed rjt-gupta closed 5 years ago
The tests are passing locally, I dont understand why it fails here.
Look at the logs and try to understand the errors. I'll look at it tomorrow.
You need to update the Travis file to use MySql service https://docs.travis-ci.com/user/database-setup/#mysql. Also, consider the password the and username.
You need to update the Travis file to use MySql service https://docs.travis-ci.com/user/database-setup/#mysql. Also, consider the password the and username.
Just when I wanted to learn more about travis. Awesome!
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
tanner/emulators/php_code_injection.py | 2 | 82.61% | ||
tanner/emulators/rfi.py | 6 | 87.34% | ||
tanner/emulators/base.py | 8 | 91.11% | ||
<!-- | Total: | 16 | --> |
Totals | |
---|---|
Change from base Build 939: | 5.2% |
Covered Lines: | 1132 |
Relevant Lines: | 1677 |
Done Finally :)
What about other methods?
Yes about that insert_dummy_data
will be added to test_mysqli
which I will push in some time. But the copy_db
method creates the database in /var/lib/mysql/*
directory. So im not sure how to test this.
What is the problem?
What is the problem?
Travis build fails to enter /var/lib/mysql
and prompts for password. Im doing more research to come up with a fix.
So, I can't directly use copy_db
method because of /var/lib/mysql
permissions. Any other way to test?
I don't think its related to any permissions. https://github.com/rjt-gupta/tanner/blob/19b7dfb7dc938586fb7aa50c390faed1cff75867/tanner/utils/mysql_db_helper.py#L73 this is the reason of prompt since password is empty so -p flag causes a prompt, had it been a non-empty password it would have worked fine
So, I guess removing the -p flag should fix the problem. Let me try.
Worked Great!
So, diff
is giving some mysql version specific comment but locally tests are passing. I think they are of not much use here and I could grep and remove such type of output but should I do this?
Refs - https://dev.mysql.com/doc/refman/8.0/en/comments.html
So,
diff
is giving some mysql version specific comment but locally tests are passing. I think they are of not much use here and I could grep and remove such type of output but should I do this?Refs - https://dev.mysql.com/doc/refman/8.0/en/comments.html
I think you can use querymap method to check existense of tables.
So,
diff
is giving some mysql version specific comment but locally tests are passing. I think they are of not much use here and I could grep and remove such type of output but should I do this?Refs - https://dev.mysql.com/doc/refman/8.0/en/comments.html
No, this is im refering for copy_db
tests as there im using diff
to get the difference in the DB dumps. Checking the tables in setup_db_from_config
is working fine.
Read this https://stackoverflow.com/questions/225772/compare-two-mysql-databases , they are discussing about flags like --opt, --compact to furthur reduce comments. I don't think grepping is good.
Read this https://stackoverflow.com/questions/225772/compare-two-mysql-databases , they are discussing about flags like --opt, --compact to furthur reduce comments. I don't think grepping is good.
Okay, will try out those but I don't get why the tests are passing locally?
Maybe check if travis has different version
Ravinder Nehra
On Tue, Jun 4, 2019, 10:04 Rajat Gupta notifications@github.com wrote:
Read this https://stackoverflow.com/questions/225772/compare-two-mysql-databases , they are discussing about flags like --opt, --compact to furthur reduce comments. I don't think grepping is good.
Okay, will try out those but I don't get why the tests are passing locally?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mushorg/tanner/pull/315?email_source=notifications&email_token=AD64W2EGYZMCS5M57DOOZFDPYXWE3A5CNFSM4HNI32JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW3MLEI#issuecomment-498517393, or mute the thread https://github.com/notifications/unsubscribe-auth/AD64W2EYHI7SQGFH2OM6ISDPYXWE3ANCNFSM4HNI32JA .
Worked Great!
Well that should not happen. Also you write code related to multiple calls earlier. Analyze carefully because if it's not then there is something wrong with it.
Ravinder Nehra
On Tue, Jun 4, 2019, 23:21 Rajat Gupta notifications@github.com wrote:
@rjt-gupta commented on this pull request.
In tanner/tests/test_mysql_db_helper.py https://github.com/mushorg/tanner/pull/315#discussion_r290419750:
- self.handler.read_config = mock_read_config
- self.handler.insert_dummy_data = AsyncMock()
- async def test():
- await self.handler.setup_db_from_config()
- for table in config["tables"]:
- await self.cursor.execute('USE test_db')
- await self.cursor.execute('DESCRIBE {table_name}'.format(table_name=table["table_name"]))
- result = await self.cursor.fetchall()
- self.result.append(result)
- self.loop.run_until_complete(test())
- self.assertEqual(self.result, self.expected_result)
- self.handler.insert_dummy_data.assert_called_with('CREDS', 'I,E,P', mock.ANY)
I have checked that but setupdbfromconfig call is only returning the last table used.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mushorg/tanner/pull/315?email_source=notifications&email_token=AD64W2G757KOOP2YQC2JU2TPY2TRXA5CNFSM4HNI32JKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB2R2DKI#discussion_r290419750, or mute the thread https://github.com/notifications/unsubscribe-auth/AD64W2DZZ7YU6VB67JQPC7LPY2TRXANCNFSM4HNI32JA .
Done.
Some pointers -
insert_dummy_data
method will be added intest_mysqli
.tearDown
phase would not work properly.