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

*: Windows compatibility fixes #2264

Merged
merged 14 commits into from Nov 29, 2021
Merged

*: Windows compatibility fixes #2264

merged 14 commits into from Nov 29, 2021

Conversation

AnnaShaleva
Copy link
Member

@AnnaShaleva AnnaShaleva commented Nov 17, 2021

Make it work on Windows properly.

TODO:

@codecov
Copy link

codecov bot commented Nov 17, 2021

Codecov Report

Merging #2264 (a6c7d32) into master (c43c51d) will increase coverage by 0.85%.
The diff coverage is 100.00%.

❗ Current head a6c7d32 differs from pull request most recent head 5ef9f44. Consider uploading reports for the commit 5ef9f44 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2264      +/-   ##
==========================================
+ Coverage   84.12%   84.97%   +0.85%     
==========================================
  Files         305      307       +2     
  Lines       29383    31210    +1827     
==========================================
+ Hits        24718    26521    +1803     
+ Misses       3279     3261      -18     
- Partials     1386     1428      +42     
Impacted Files Coverage Δ
cli/server/server.go 64.84% <100.00%> (+0.24%) ⬆️
cli/smartcontract/smart_contract.go 88.92% <100.00%> (ø)
pkg/compiler/compiler.go 75.15% <100.00%> (ø)
pkg/io/fileWriter.go 100.00% <100.00%> (ø)
pkg/network/metrics/metrics.go 69.23% <0.00%> (-15.39%) ⬇️
pkg/services/oracle/oracle.go 86.48% <0.00%> (-1.81%) ⬇️
pkg/core/stateroot/store.go 72.22% <0.00%> (-1.12%) ⬇️
pkg/consensus/consensus.go 72.60% <0.00%> (-0.55%) ⬇️
pkg/services/helpers/rpcbroadcaster/client.go 0.00% <0.00%> (ø)
pkg/core/state/tokens.go 81.33% <0.00%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c43c51d...5ef9f44. Read the comment docs.

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make a single commit for all path/filepath things and then fix other things.

cli/server/server_test.go Outdated Show resolved Hide resolved
cli/options/options_test.go Show resolved Hide resolved
cli/server/server_test.go Outdated Show resolved Hide resolved
cli/smartcontract/smart_contract.go Outdated Show resolved Hide resolved
.github/workflows/run_tests.yml Outdated Show resolved Hide resolved
.github/workflows/run_tests.yml Outdated Show resolved Hide resolved
@AnnaShaleva AnnaShaleva force-pushed the fix-win-tests branch 2 times, most recently from 041b9bf to 676401b Compare November 18, 2021 14:18
@AnnaShaleva
Copy link
Member Author

#2268 related to failing VM CLI tests.

Problem:
```
--- FAIL: TestGetTimeoutContext (0.00s)
    --- FAIL: TestGetTimeoutContext/default (0.00s)
        options_test.go:44:
                Error Trace:    options_test.go:44
                Error:          Should be true
                Test:           TestGetTimeoutContext/default
    --- FAIL: TestGetTimeoutContext/set (0.00s)
        options_test.go:55:
                Error Trace:    options_test.go:55
                Error:          Should be true
                Test:           TestGetTimeoutContext/set
FAIL
```

Solution:
Allow deadline be equal to expected end time.
@AnnaShaleva AnnaShaleva force-pushed the fix-win-tests branch 21 times, most recently from f8b688e to a2267aa Compare November 22, 2021 13:30
@AnnaShaleva AnnaShaleva force-pushed the fix-win-tests branch 2 times, most recently from 6f5b3c6 to 94e3c67 Compare November 25, 2021 08:40
@AnnaShaleva AnnaShaleva marked this pull request as ready for review November 25, 2021 09:04
if ($args[$i] -eq "node"){
Write-Host "=> Try to restore blocks before running node"
if (($Env:ACC -ne $null) -and (Test-Path $Env:ACC -PathType Leaf)) {
& $bin db restore -p --config-path /config -i $Env:ACC
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we neet to unpack/unzip before trying to restore? IIUC, bash script for Ubuntu performs unzipping.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's relevant now, we've used ACC way back in Legacy days to prime the chain with 6K blocks generating some GAS (there was no GAS generated in the genesis block there), nowadays it's seems unnecessary. We can leave this as is for now.

cli/server/server_test.go Show resolved Hide resolved
pkg/core/storage/boltdb_store_test.go Show resolved Hide resolved
pkg/io/fileWriter.go Show resolved Hide resolved
cli/server/server_test.go Show resolved Hide resolved
pkg/core/blockchain_test.go Outdated Show resolved Hide resolved
pkg/vm/cli/cli_test.go Outdated Show resolved Hide resolved
cli/smartcontract/smart_contract.go Show resolved Hide resolved
@@ -0,0 +1,15 @@
#!C:\Program Files\PowerShell\7\pwsh.EXE -File
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks weird, but I'm not sure what's correct for Windows, so we can try going with this one until someone tells us what's more appropriate here.

if ($args[$i] -eq "node"){
Write-Host "=> Try to restore blocks before running node"
if (($Env:ACC -ne $null) -and (Test-Path $Env:ACC -PathType Leaf)) {
& $bin db restore -p --config-path /config -i $Env:ACC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's relevant now, we've used ACC way back in Legacy days to prime the chain with 6K blocks generating some GAS (there was no GAS generated in the genesis block there), nowadays it's seems unnecessary. We can leave this as is for now.

Dockerfile.wsc Outdated
COPY --from=builder /neo-go/config /config
COPY --from=builder /neo-go/.docker/privnet-entrypoint.ps1 /usr/bin/privnet-entrypoint.ps1
COPY --from=builder /neo-go/bin/neo-go.exe /usr/bin/neo-go.exe
# TODO: Windows Server doesn't have default crt, need to export certs from certmgr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But do we need to do this on Windows? I'm not sure where the client gets certificates from there.

@AnnaShaleva AnnaShaleva force-pushed the fix-win-tests branch 2 times, most recently from e5d87b8 to c222e20 Compare November 26, 2021 15:25
Problem:
```
--- FAIL: TestHandleLoggingParams (0.02s)
    --- FAIL: TestHandleLoggingParams/default (0.00s)
        server_test.go:51:
                Error Trace:    server_test.go:51
                Error:          Received unexpected error:
                                couldn't open sink "C:\\Users\\Anna\\AppData\\Local\\Temp\\TestHandleLoggingParams226652490\\001/file.log": no sink found for scheme "c"
                Test:           TestHandleLoggingParams/default
    --- FAIL: TestHandleLoggingParams/debug (0.00s)
        server_test.go:64:
                Error Trace:    server_test.go:64
                Error:          Received unexpected error:
                                couldn't open sink "C:\\Users\\Anna\\AppData\\Local\\Temp\\TestHandleLoggingParams226652490\\001/file.log": no sink found for scheme "c"
                Test:           TestHandleLoggingParams/debug
```

Solution:
Currently no solution is implemented, but we can use relative paths instead of absolute.
Problem:
```
--- FAIL: TestMemCachedPersist (0.07s)
    --- FAIL: TestMemCachedPersist/BoltDBStore (0.07s)
        testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestMemCachedPersist_BoltDBStore294966711\001\test_bolt_db: The process cannot access the file because it is being used by another process.
```

Solution:
Release the resources occupied by the DB.
Problem:
```
--- FAIL: TestMakeDirForFile_HappyPath (0.01s)
    testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestMakeDirForFile_HappyPath402638411\001\testDir\testFile.test: The process cannot access the file because it is being used by another process.
--- FAIL: TestMakeDirForFile_Negative (0.01s)
    testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestMakeDirForFile_Negative672737582\001\testFile.test: The process cannot access the file because it is being used by another process.
FAIL
```

Solution:
Release resources occupied by os.Create.
pkg/vm/cli/cli_test.go Show resolved Hide resolved
.github/workflows/run_tests.yml Outdated Show resolved Hide resolved
.github/workflows/run_tests.yml Outdated Show resolved Hide resolved
AnnaShaleva and others added 10 commits November 29, 2021 11:09
It is helpful if something goes wrong.
Solution:
Use `file/filepath` package to construct expected path. This package is OS-aware, see golang/go#30616.
Problem:
```
--- FAIL: TestDumpDB (0.08s)
--- FAIL: TestDumpDB/too_low_chain
testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestDumpDB_too_low_chain357310492\001\chains\privnet\000001.log: The process cannot access the file because it is being used by another process.
```

Solution:
Release resources occupied by the chain even on non-error command exit.
We're building inside Docker container, so we don't need golang to
be installed on the host machine.
There's too much jobs in Tests workflow, so we can split them into several parts.
Also, remove Go setup from publishing jobs because we don't need Go on runner.
@roman-khimov roman-khimov merged commit 33e37e6 into master Nov 29, 2021
@roman-khimov roman-khimov deleted the fix-win-tests branch November 29, 2021 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants