-
-
Notifications
You must be signed in to change notification settings - Fork 447
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
Question: Is there a better way to do unit test #431
Comments
Forget tests.sh it's functional tests for me. I should do a "work for everyone" mode but I'm lazy
are faster and cover many things. |
Hello @gilleslamiral, I apologize for the delayed response. I have used the commands you provided and discovered that some tests failed. I have fixed the issues after reviewing the code over the last few days(I'm not familiar with perl:( ). However, it appears that the domain in Can I create a pull request to fix these failed tests? |
If you spend time on imapsync, work on this one instead: |
Great! I will use this version for unit test. |
Hi @gilleslamiral , I'm use the latest version of imapsync and ran
Upon reviewing the code, it seem that the I made the following changes, and the diff --git a/imapsync b/imapsync
index f8cf1e0..94dbb07 100644
--- a/imapsync
+++ b/imapsync
@@ -4239,14 +4239,14 @@ sub tests_cgidir
else
{
my $mysync = { } ;
- is( '/var/tmp/imapsync_cgi/385d7a4d8d428d7aa2b57c8982629e2bd67698ed', cgidir( $mysync ), 'tests_cgidir: { } => /var/tmp/imapsync_cgi/385d...' ) ;
+ is( '/var/tmp/imapsync_cgi/70348345eb2460c97129e7a3f8ffb8842e90c4e4', cgidir( $mysync ), 'tests_cgidir: { } => /var/tmp/imapsync_cgi/7034...' ) ;
{
local $ENV{ NET_SERVER_SOFTWARE } = 'Net::Server::HTTP' ;
is( '.', cgidir( $mysync ), 'tests_cgidir: Net::Server::HTTP => .' ) ;
$mysync->{ dockercontext } = 1 ;
- is( '/var/tmp/imapsync_cgi/385d7a4d8d428d7aa2b57c8982629e2bd67698ed', cgidir( $mysync ), 'tests_cgidir: Net::Server::HTTP + Docker => /var/tmp/imapsync_cgi/385d...' ) ;
+ is( '/var/tmp/imapsync_cgi/70348345eb2460c97129e7a3f8ffb8842e90c4e4', cgidir( $mysync ), 'tests_cgidir: Net::Server::HTTP + Docker => /var/tmp/imapsync_cgi/7034...' ) ;
} ;
}
@@ -4268,7 +4268,7 @@ sub cgidir
{
$mysync->{ hashfile } = $CGI_HASHFILE ;
- my $hashsynclocal = hashsynclocal( $mysync ) || die "Can not get hashsynclocal. Exiting\n" ;
+ my $hashsynclocal = hashsynclocal( $mysync, 'uuzvalmsxltblnsvyvdidshqnmmaelym' ) || die "Can not get hashsynclocal. Exiting\n" ;
if ( ! under_docker_context( $mysync ) and under_Net_Server_HTTP( ) )
{
@@ -5729,10 +5729,12 @@ sub hashsynclocal
if ( ! $hashfile ) {
return ;
}
- $hashkey = firstline( $hashfile ) ;
if ( ! $hashkey ) {
- myprint( "No hashkey!\n" ) ;
- return ;
+ $hashkey = firstline( $hashfile ) ;
+ if ( ! $hashkey ) {
+ myprint( "No hashkey!\n" ) ;
+ return ;
+ }
}
my $hashsynclocal = hashsync( $mysync, $hashkey ) ;
return( $hashsynclocal ) ;
|
That's the purpose of hashsynclocal(), it generates a different hash on each /X instance, unless they share a common hashkey stored in /var/tmp/imapsync_hash
I don't want a stable hash across /X unrelated instances. The goal is to make the log directory path unpredictable for an online service you don't own. |
I'm sorry, but if there isn't a stable hash, it implies that the |
Yes. It's a bug. My turn to fix it, unless you have time with that shit. |
I apologize for the confusion; it was my mistake.
I noticed that you updated the Thank you. |
- Using other test scripts, ref: imapsync/imapsync#431 - Comment out some tests because IPv6 needs to be used
- Using other test scripts, ref: imapsync/imapsync#431 - Comment out some tests because IPv6 needs to be used - Upstreamed to archlinux: https://gitlab.archlinux.org/archlinux/packaging/packages/imapsync/-/merge_requests/1
- Using other test scripts, ref: imapsync/imapsync#431 - Comment out some tests because IPv6 needs to be used - Upstreamed to archlinux: https://gitlab.archlinux.org/archlinux/packaging/packages/imapsync/-/merge_requests/1
Yes
|
Hello!
I successfully built imapsync using the PKGBUILD (Arch Linux package build description file). You can find the PKGBUILD file at this link: https://gitlab.archlinux.org/archlinux/packaging/packages/imapsync/-/blob/main/PKGBUILD.
The build process proceeded smoothly; however, I encountered an issue during the check function's execution of the make test command, which will run the
tests.sh
script. This script relies on a running IMAP server with several accounts, and some of its test functions require access to email secrets. Unfortunately, this setup causes the tests to fail.Despite the failure, the script continues its execution. Specifically, the
ll_env_password
function attempts to test a password sent via environment variable. The environment variable is set to runcat ../../var/pass/secret.tata
orsecret.titi
, but this fails. As a result, imapsync prompts the user to enter the password in the terminal. This manual input maybe not very good, especially on a remote server. There are a number of places incat ../../var/pass/secret.tata
where secret is used, so maybe we can skip those tests? Now, I just removell_env_password
frommandatory_tests
.The text was updated successfully, but these errors were encountered: