Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

ci: Cleanup Service Integration Tests #24

Closed
wants to merge 1 commit into from

Conversation

abyss-w
Copy link
Contributor

@abyss-w abyss-w commented Sep 8, 2021

ci: Cleanup Service Integration Tests

@abyss-w
Copy link
Contributor Author

abyss-w commented Sep 8, 2021

ping @Xuanwo to add integration tests in teamcity.

@Xuanwo
Copy link
Contributor

Xuanwo commented Sep 8, 2021

Oh, we have not set up gdrive tests before, I need some time to figure it out.

@Xuanwo
Copy link
Contributor

Xuanwo commented Sep 8, 2021

ping @junaire , I run the integration tests with the following error:

    When Read a file
      The error should be nil ✘    storager.go:56: delete: Storager gdrive {Name: demo, WorkDir: /41205f59-f648-43bf-8e3f-2d8344b8c7e5}, [16756b17-ab73-49e4-807b-3f71a6216178]: unexpected: googleapi: Error 400: Invalid Value, invalidThe content should be match ✔✘    storager.go:56: delete: Storager gdrive {Name: demo, WorkDir: /41205f59-f648-43bf-8e3f-2d8344b8c7e5}, [dc7a65cb-7d32-4eb9-964b-e1387512ee8c]: unexpected: googleapi: Error 400: Invalid Value, invalidWhen Write a file
      The first returned error should be nil^CFAIL    github.com/beyondstorage/go-service-gdrive/tests        9.718s
make: *** [Makefile:35: integration_test] Error 1

Do you know why? Is there anything is configured in wrong?

@junaire
Copy link
Member

junaire commented Sep 8, 2021

ping @junaire , I run the integration tests with the following error:

    When Read a file
      The error should be nil ✘    storager.go:56: delete: Storager gdrive {Name: demo, WorkDir: /41205f59-f648-43bf-8e3f-2d8344b8c7e5}, [16756b17-ab73-49e4-807b-3f71a6216178]: unexpected: googleapi: Error 400: Invalid Value, invalidThe content should be match ✔✘    storager.go:56: delete: Storager gdrive {Name: demo, WorkDir: /41205f59-f648-43bf-8e3f-2d8344b8c7e5}, [dc7a65cb-7d32-4eb9-964b-e1387512ee8c]: unexpected: googleapi: Error 400: Invalid Value, invalidWhen Write a file
      The first returned error should be nil^CFAIL    github.com/beyondstorage/go-service-gdrive/tests        9.718s
make: *** [Makefile:35: integration_test] Error 1

Do you know why? Is there anything is configured in wrong?

Sorry but the error message you gave is too general, I don't know where is wrong. Can you please put more information about where is wrong? Can you please describe how you run the tests? How can I see the tests content?

BTW, here is a known bug about gdrive service I didn't have time to fix:

file := &drive.File{Name: s.getFileName(path)}

We forgot to set parents field when create a new File. In this case, It will be root. So when write a/b/c.txt, we will get:

.
|_ a
|  |_ b
|_ c.txt

I'm not sure if this is the point.
See Line25 and Line275 in storage.go

.gitignore Outdated
Comment on lines 1 to 6
bin/ No newline at end of file
bin/

# Jetbrain IED
.idea
*.iml
Copy link
Member

Choose a reason for hiding this comment

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

Hello, I don't think we should ignore these things in specific projects. If you don't want to mess up the code base, you can ignore these editor and IDE things globally.
For example:

$ git config --global core.excludesfile ~/.gitignore_global

Then you can ignore these things in ~/.gitignore_global

@Xuanwo
Copy link
Contributor

Xuanwo commented Sep 8, 2021

I'm not sure if this is the point.

It seems like that, our integration tests will write a file and delete.

Can you running make integration_test at your side?

@junaire
Copy link
Member

junaire commented Sep 8, 2021

Here I put part of the result of the integration tests:

$ make integration_test
go test -race -count=1 -covermode=atomic -v ./tests
=== RUN   TestStorage
    utils_test.go:15: Setup test for gdrive

  Given a basic Storager ✔
    When String called 
      The string should not be empty ✔✔
    When Metadata called 
      The metadata should not be empty ✔✔
    When Read a file 
      The error should be nil ✘    storager.go:56: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [b05f7be5-db31-4f74-b995-926117089a1b]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
      The content should be match ✔✘    storager.go:56: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [cc7de37a-75a8-41d0-98d0-f79511617f17]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
    When Write a file 
      The first returned error should be nil ✔    storager.go:87: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [a378b85b-8f57-469c-8979-43b444a7bf4d]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
      The second returned error also should be nil ✔    storager.go:87: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [8811bb68-a2ba-40b1-9da3-c3ed7838568e]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
      Stat should get Object without error 
        The error should be nil ✘    storager.go:87: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [73dbd3e3-ba2c-4279-b508-7dd340aa92d1]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
        The name and size should be match ✘    storager.go:87: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [42e9a2b7-74da-47a1-82ee-cdc5f90fb97f]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
      Read should get Object data without error 
        The error should be nil ✘    storager.go:87: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [27014407-4fe1-41c1-9b32-13991070265f]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
        The content should be match ✔✘    storager.go:87: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [228b609a-459e-43a2-abf7-4e515bc5279b]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
    When Stat a file 
      The error should be nil ✘    storager.go:154: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [61dcf6e4-a0cb-4eab-862a-34fb0860d8de]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
      The Object name and size should be match ✘    storager.go:154: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [38f4c5ce-5eb5-4f10-ac1e-266a7c7edb58]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
    When Delete a file 
      The first returned error should be nil ✘✔
      The second returned error also should be nil ✘✔
      Stat should get nil Object and ObjectNotFound error ✘✔
    When List an empty dir 
      The error should be nil ✔✔
      The iterator should not be nil ✔✔
      The next should be done ✘✔
      The object should be nil ✔✔
    When List a dir within files 
      The error should be nil ✔    storager.go:238: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [e3d6324a-2ae6-4218-8cf0-809dd6995f48]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔
      The iterator should not be nil ✔    storager.go:238: delete: Storager gdrive {Name: demo, WorkDir: /b0c97d9a-48f4-4a76-9b7f-8658dbe13f65}, [8463067f-8109-46ed-9739-74e47b804e2e]: unexpected: googleapi: Error 400: Invalid Value, invalid
✔^CFAIL github.com/beyondstorage/go-service-gdrive/tests        35.467s

@junaire
Copy link
Member

junaire commented Sep 9, 2021

I'm not sure if this is the point.

It seems like that, our integration tests will write a file and delete.

Can you running make integration_test at your side?

I will fix this later

@Xuanwo
Copy link
Contributor

Xuanwo commented Sep 9, 2021

I will fix this later

I create an issue #25 for it, we will continue this PR after the issue has been solved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants