Bug 370696 - [server][test] Add a better helper for git operations run as task
Summary: [server][test] Add a better helper for git operations run as task
Status: RESOLVED WONTFIX
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Git (show other bugs)
Version: 0.4   Edit
Hardware: PC All
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks: 342820
  Show dependency tree
 
Reported: 2012-02-06 05:16 EST by Malgorzata Janczarska CLA
Modified: 2015-05-05 14:45 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Malgorzata Janczarska CLA 2012-02-06 05:16:41 EST
We have currently a few helpers that help us run operations that might be run as tasks, however we have to user different operations depending on if we expect the task to fail or succeed. We also have some custom walkaround in tests to handle some special situations. I think we should create a handler that would be a used as a proxy for all git operations that would be smart enough to handle tasks and do some basic asserts. We have a handler like this on UI and it works fine so we can do something analogical in tests.
Comment 1 Tomasz Zarna CLA 2012-02-06 05:43:40 EST
A better fix to bug 369034 would be delaying subsequent commits in all tests but only when required rather than adding Thread.sleep() on demand. That would require the helper to remember the time of the last commit so the next one isn't created too early.
Comment 2 Tomasz Zarna CLA 2012-02-09 04:25:04 EST
(In reply to comment #0)

I can think of at least 3 approaches here:

1. Since what flies between the server and the test framework are JSON objects I would encapsulate them in objects like TestFile, TestFolder, TestClone and so on. The next step would be to add some convenience methods which are now gathered as statics in GitTest.java. A test could look like this then:

	TestClone tc = TestClone.create("ssh://...");
	TestFile tf = tc.getProject().getFile("folder/test.txt");
	tf.setContents("hello");
	tf.add().commit("commit");
	assertEquals(1, tc.log().size());

2. Replace the current implementation of JGit commands, so they call our REST API. Writing an Orion Git test would be the same as JGit test.
3. Allow to code tests with a bash-like notation: "clone 'ssh...'; echo 'hello' > folder/test.txt; add folder/test.txt;commit -m 'commit'". See bug 365444 for a similar enhancement request in JGit.
Comment 3 Szymon Brandys CLA 2012-03-02 07:28:22 EST
Who is going to look at it?
Comment 4 John Arthorne CLA 2015-05-05 14:45:29 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:

https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html