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

Added check for tika jar file, updated accompanying test #18

Merged
merged 3 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tika/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ var command = exec.Command
// Server. Start will wait for the server to be available or until ctx is
// cancelled.
func (s *Server) Start(ctx context.Context) error {

if _, err := os.Stat(s.jar); os.IsNotExist(err) {
return err
}
Comment on lines +131 to +133
Copy link
Member

Choose a reason for hiding this comment

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

Should we do this in NewServer? Could see doing it in either function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, could be in either. Pathing of where things are called from could come into play, which is why I put it here and not in NewServer.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me.


//create a slice of Java system properties to be passed to the JVM
props := []string{}
for k, v := range s.JavaProps {
Expand Down
4 changes: 4 additions & 0 deletions tika/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ func TestStartError(t *testing.T) {
if err := s.Start(ctx); err == nil {
t.Fatalf("s.Start got no error, want error")
}
s.jar = "nonexistentFile.jar"
if err := s.Start(ctx); err == nil {
t.Fatalf("s.Start got no error, want error for missing Jar file")
}
Comment on lines +116 to +119
Copy link
Member

Choose a reason for hiding this comment

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

Please add this to TestStartError (which may need to be updated to point to real files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is in TestStartError. I am unsure of what your are asking.

Copy link
Member

Choose a reason for hiding this comment

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

Ah. You're totally right, my bad.

}

func TestURL(t *testing.T) {
Expand Down